00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _hyp_com_container_h_
00031 #define _hyp_com_container_h_
00032
00033 #ifndef hypfem_INSIDE_INTERN
00034 #error Inclusion not allowed (include hyp.fem.intern.h instead)
00035 #endif
00036
00037
00048 class CContainer :
00049 #ifdef hypfem_IDENTIFY_CONSTRUCTION_ON
00050 protected CIDClass,
00051 #endif
00052 public IContainer,
00053 public IContainerKey,
00054 public IContainerIterator,
00055 public hyp_ker::CUnknown
00056 {
00057 public:
00059 CContainer(hyp_ker::IUnknown*);
00060 virtual ~CContainer();
00061 hyp_DECLARE_IUNKNOWN
00062 virtual hyp_ker::com_result NondelegatingQueryInterface(const hyp_ker::hypIID&,void**);
00063 static hyp_ker::com_result CreateInstance(hyp_ker::IUnknown* ,hyp_ker::CUnknown**);
00065
00069 virtual void Add(hyp_ker::IUnknown*);
00070 virtual void RemoveAll();
00071 virtual t_size GetSize() const;
00072 virtual void Remove(hyp_ker::IUnknown*);
00074
00078 virtual void Add(hyp_ker::IUnknown*,const t_label&);
00079 virtual void Remove(const t_label&);
00080 virtual hyp_ker::IUnknown* GetContent(const t_label&);
00081 virtual t_label GetKey(hyp_ker::IUnknown*);
00082 virtual void SetKey(hyp_ker::IUnknown*,const t_label&);
00084
00088 virtual hyp_ker::IUnknown* SetBeginSelection();
00089 virtual hyp_ker::IUnknown* GetSelection();
00090 virtual hyp_ker::IUnknown* IncrSelection();
00092
00093 private:
00094 class Container
00095 {
00096 public:
00097 struct Content {
00098 Content();
00099 Content(const t_label& label,hyp_ker::IUnknown* p) : m_Label(label),m_pIUnknown(p) {}
00100 Content(const Content& content) {
00101 m_pIUnknown=content.m_pIUnknown;m_Label=content.m_Label; }
00102 ~Content() {}
00103 t_label m_Label;
00104 hyp_ker::IUnknown* m_pIUnknown;
00105 };
00106 typedef std::vector<Content> t_ContBase;
00107 private:
00108 t_ContBase m_ContainerBase;
00109
00110 public:
00111
00112 Container(const Container&);
00113
00114 Container() { m_ContainerBase.reserve(100); };
00115 ~Container();
00116 void Insert(const t_label&,hyp_ker::IUnknown*);
00117 t_ContBase::iterator TypeAlreadyExists(hyp_ker::IUnknown*);
00118 t_ContBase::iterator KeyAlreadyExists(const t_label&);
00119 void Clear(void);
00120 void Erase(t_ContBase::iterator);
00121 t_label GetMaximumLabel(void) const;
00122 inline t_ContBase::iterator Begin(void) { return m_ContainerBase.begin(); }
00123 inline t_ContBase::iterator End(void) { return m_ContainerBase.end(); }
00124 inline t_size Size(void) const { return m_ContainerBase.size(); }
00125 inline bool Empty(void) const { return m_ContainerBase.empty(); }
00126 void _debug_container(void);
00127
00128 } m_Container;
00129 Container::t_ContBase::const_iterator m_Selection;
00130
00136 inline bool ContentIsValid(hyp_ker::IUnknown* pObject) {
00137 return (pObject!=0)&&((void*)(pObject)!=(void*)(this));
00138 }
00139
00140 };
00141
00142
00143 #endif