00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef TECPLOT_TOOLBOX_SET_H
00012 #define TECPLOT_TOOLBOX_SET_H
00013
00014 #if defined MSWIN
00015 #pragma once
00016 #endif
00017
00018 #include <string>
00019 #include <set>
00020 #include <iosfwd>
00021 #include "tptoolbox.h"
00022
00023 namespace tecplot
00024 {
00025 namespace toolbox
00026 {
00027
00034 class TPTOOLBOX_DLLAPI Set
00035 {
00036 public:
00043 explicit Set();
00044
00054 explicit Set(SetIndex_t member);
00055
00080 explicit Set(std::string strValue);
00081
00098 explicit Set(std::set<int> const& stdSet);
00099
00121 explicit Set(Set_pa set);
00122
00132 Set(const Set& set);
00133
00134 virtual ~Set();
00135
00149 virtual bool operator==(const Set& rhs) const;
00150
00163 virtual bool operator!=(const Set& rhs) const;
00164
00165
00175 virtual Set& operator=(SetIndex_t rhs);
00176
00186 virtual Set& operator=(const Set& rhs);
00187
00205 virtual Set& operator=(const std::string rhs);
00206
00216 virtual Set& operator+=(SetIndex_t rhs);
00217
00227 virtual Set& operator+=(const Set& rhs);
00228
00246 virtual Set& operator+=(const std::string rhs);
00247
00254 virtual Set& operator-=(SetIndex_t member);
00255
00262 virtual Set& operator-=(const Set& rhs);
00263
00282 virtual Set& operator-=(const std::string rhs);
00283
00293 virtual void add(SetIndex_t member);
00294
00304 virtual void add(const Set& set);
00305
00312 virtual void remove(SetIndex_t member);
00313
00320 virtual void remove(const Set& set);
00321
00325 virtual void clear();
00326
00336 virtual void assign(const Set& set);
00337
00363 virtual void assign(std::string strValue);
00364
00374 virtual void toStdSet(std::set<int>& stdSet);
00375
00386 virtual std::string toString() const;
00387
00396 virtual Set_pa getRef() const;
00397
00408 virtual SetIndex_t get(SetIndex_t position) const;
00409
00416 virtual SetIndex_t size() const;
00417
00433 virtual SetIndex_t getNext(SetIndex_t member) const;
00434
00445 virtual SetIndex_t getPosition(SetIndex_t member) const;
00446
00463 static Set intersection(const Set& set1, const Set& set2);
00464
00471 virtual bool isEmpty() const;
00472
00483 virtual bool isEqual(const Set& other) const;
00484
00494 virtual bool isMember(SetIndex_t member) const;
00495
00502 virtual bool isValidMember(SetIndex_t member) const
00503 {
00504 return member >= 1;
00505 }
00506
00513 virtual bool isValidPosition(SetIndex_t position) const
00514 {
00515 return position >= 1;
00516 }
00517
00518 private:
00521 void alloc();
00524 void dealloc();
00527 void copy(Set_pa set);
00528
00529 Set_pa m_set;
00530 };
00531
00535 TPTOOLBOX_DLLAPI std::ostream& operator<<(std::ostream& outputStream,
00536 const Set& set);
00537
00538 }
00539 }
00540
00541 #endif