+class NetDest
+{
+ public:
+ // Constructors
+ // creates and empty set
+ NetDest();
+ explicit NetDest(int bit_size);
+
+ NetDest& operator=(const Set& obj);
+
+ ~NetDest()
+ { }
+
+ void add(MachineID newElement);
+ void addNetDest(const NetDest& netDest);
+ void setNetDest(MachineType machine, const Set& set);
+ void remove(MachineID oldElement);
+ void removeNetDest(const NetDest& netDest);
+ void clear();
+ void broadcast();
+ void broadcast(MachineType machine);
+ int count() const;
+ bool isEqual(const NetDest& netDest) const;
+
+ // return the logical OR of this netDest and orNetDest
+ NetDest OR(const NetDest& orNetDest) const;
+
+ // return the logical AND of this netDest and andNetDest
+ NetDest AND(const NetDest& andNetDest) const;
+
+ // Returns true if the intersection of the two netDests is non-empty
+ bool intersectionIsNotEmpty(const NetDest& other_netDest) const;
+
+ // Returns true if the intersection of the two netDests is empty
+ bool intersectionIsEmpty(const NetDest& other_netDest) const;
+
+ bool isSuperset(const NetDest& test) const;
+ bool isSubset(const NetDest& test) const { return test.isSuperset(*this); }
+ bool isElement(MachineID element) const;
+ bool isBroadcast() const;
+ bool isEmpty() const;
+
+ // For Princeton Network
+ std::vector<NodeID> getAllDest();
+
+ MachineID smallestElement() const;
+ MachineID smallestElement(MachineType machine) const;
+
+ void resize();
+ int getSize() const { return m_bits.size(); }
+
+ // get element for a index
+ NodeID elementAt(MachineID index);
+
+ void print(std::ostream& out) const;
+
+ private:
+ // returns a value >= MachineType_base_level("this machine")
+ // and < MachineType_base_level("next highest machine")
+ int
+ vecIndex(MachineID m) const
+ {
+ int vec_index = MachineType_base_level(m.type);
+ assert(vec_index < m_bits.size());
+ return vec_index;
+ }
+
+ NodeID bitIndex(NodeID index) const { return index; }
+
+ std::vector<Set> m_bits; // a vector of bit vectors - i.e. Sets