00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Robert Vinluan 00008 * Side Effects 00009 * 123 Front St. West, Suite 1401 00010 * Toronto, Ontario 00011 * Canada M5J 2M2 00012 * 416-504-9876 00013 * 00014 * 00015 * NAME: OP_OpTypeIdFilter.h, OP Library (C++) 00016 * 00017 * COMMENTS: This is a filter class which filters nodes by their 00018 * operator type ids. 00019 * 00020 */ 00021 00022 #ifndef __OP_OpTypeIdFilter_h__ 00023 #define __OP_OpTypeIdFilter_h__ 00024 00025 #include "OP_API.h" 00026 00027 #include "OP_Node.h" 00028 00029 /// This is a filter class which filters nodes by their 00030 /// operator type ids. 00031 class OP_API OP_OpTypeIdFilter 00032 { 00033 public: 00034 00035 /// Constructor. 00036 OP_OpTypeIdFilter(); 00037 00038 /// Copy constructor. 00039 OP_OpTypeIdFilter(const OP_OpTypeIdFilter &filter); 00040 00041 /// Destructor. 00042 virtual ~OP_OpTypeIdFilter(); 00043 00044 /// Returns true if the given node is accepted by the filter. 00045 /// Returns false otherwise. 00046 bool isAcceptableNode(OP_Node *node) const; 00047 00048 /// Returns true if the the filter has the operator type id. 00049 /// Returns false otherwise. 00050 bool hasOpTypeId(OP_OpTypeId opType) const; 00051 00052 /// Sets whether we should be checking a network's child op type 00053 /// when determining if it is accepted by this filter. 00054 /// This logic is used in isAcceptableNode(). 00055 void setCheckChildOpTypeId(bool doChildCheck) 00056 { myDoChildCheck = doChildCheck; } 00057 00058 /// Sets the mask for the operator type id. 00059 void setFilterMask(OP_OpTypeId opType, 00060 bool doMask=true); 00061 00062 /// Resets the filter by setting each mask to the reset value. 00063 void resetFilter(bool resetValue=true); 00064 00065 /// Assignment operator. 00066 OP_OpTypeIdFilter &operator=(const OP_OpTypeIdFilter &str); 00067 00068 private: 00069 00070 /// Operator type id masks. 00071 /// If myOpTypeIdMasks[id] is true, then it means that nodes with 00072 /// "id" type should be kept, otherwise, they should be filtered out. 00073 bool myOpTypeIdMasks[NUM_MANAGERS]; 00074 00075 /// If true, then we also check a network's child op type 00076 /// when determining whether a node is accepted by this filter. 00077 bool myDoChildCheck; 00078 }; 00079 00080 #endif
1.5.9