Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

hyp.com.container.h

00001 /*
00002 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
00003  Ephydryne Components.
00004  Ephydryne is a part of the Hyperion Project.
00005 ----------------------------------------------------------
00006  Copyright (c) 2001 Pierre Rebours.
00007 
00008  This library is free software; you can redistribute it and/or
00009  modify it under the terms of the GNU Lesser General Public
00010  License as published by the Free Software Foundation; either
00011  version 2.1 of the License, or (at your option) any later version.
00012 
00013  This library is distributed in the hope that it will be useful,
00014  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  
00017  See hyp.license.txt file for more information about the license.
00018  
00019  Web: http://lagrandeporte.multimania.com/hyperion
00020  Email: pierre_rebours@yahoo.com
00021 ----------------------------------------------------------
00022  CVS
00023  $Log$
00024 
00025  Creation 11/03/01 Pierre Rebours
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();/* :  m_Label(0), m_pIUnknown(0) {}*/
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                 //no defined
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

Top of Page
written by Pierre Rebours © 2000-2001. Terms of Use.