CMS 3D CMS Logo

Ig3DObjectCategory< T > Class Template Reference

#include <Iguana/GLBrowsers/interface/Ig3DObjectCategory.h>

Inheritance diagram for Ig3DObjectCategory< T >:

IgControlCategory IgControlItem

List of all members.

Public Member Functions

virtual void add (T *object, bool option=true)
virtual void clear (void)
virtual size_t find (T *object)
 Ig3DObjectCategory (IgState *state, QString title, int flags=MultiItem|ManageItems|MonitorChanges)
virtual size_t objects (void) const
virtual void registerBrowser (IgState *state, Ig3DBaseBrowser *)
virtual void remove (size_t index)
virtual void remove (T *object)
virtual void rename (size_t index, const QString &newName)
virtual void rename (T *object, const QString &newName)
virtual void replace (size_t index, T *with)
virtual void replace (T *object, T *with)

Protected Member Functions

virtual T * object (size_t index) const

Private Attributes

std::vector< T * > m_objects


Detailed Description

template<class T>
class Ig3DObjectCategory< T >

Definition at line 25 of file Ig3DObjectCategory.h.


Constructor & Destructor Documentation

template<class T>
Ig3DObjectCategory< T >::Ig3DObjectCategory ( IgState state,
QString  title,
int  flags = MultiItem | ManageItems | MonitorChanges 
) [inline]

Definition at line 61 of file Ig3DObjectCategory.h.

00063     : IgControlCategory (state, title, flags )
00064 {}


Member Function Documentation

template<class T>
void Ig3DObjectCategory< T >::add ( T *  object,
bool  option = true 
) [inline, virtual]

Definition at line 99 of file Ig3DObjectCategory.h.

References IgControlCategory::addItem(), Ig3DBaseModel::decode(), and Ig3DObjectCategory< T >::m_objects.

00100 {
00101     m_objects.push_back (object);
00102     addItem (Ig3DBaseModel::decode (object->getName()).c_str (),
00103              option);
00104 }

template<class T>
void Ig3DObjectCategory< T >::clear ( void   )  [inline, virtual]

Definition at line 159 of file Ig3DObjectCategory.h.

References Ig3DObjectCategory< T >::objects().

00160 {
00161     while (objects ())
00162         remove ((size_t) 0);
00163 }

template<class T>
size_t Ig3DObjectCategory< T >::find ( T *  object  )  [inline, virtual]

Definition at line 88 of file Ig3DObjectCategory.h.

References ASSERT, find(), IgControlCategory::items(), and Ig3DObjectCategory< T >::m_objects.

Referenced by Ig3DObjectCategory< T >::remove(), Ig3DObjectCategory< T >::rename(), and Ig3DObjectCategory< T >::replace().

00089 {
00090     size_t pos = std::find (m_objects.begin (), m_objects.end (), object)
00091                  - m_objects.begin ();
00092     ASSERT (pos != m_objects.size ());
00093     ASSERT (pos != (size_t) items ());
00094     return pos;
00095 }

template<class T>
T * Ig3DObjectCategory< T >::object ( size_t  index  )  const [inline, protected, virtual]

Definition at line 73 of file Ig3DObjectCategory.h.

References ASSERT, and Ig3DObjectCategory< T >::m_objects.

00074 { 
00075     if (m_objects.size () != 0)
00076     {
00077         ASSERT (index < m_objects.size ()); 
00078         return m_objects [index]; 
00079     }
00080     else
00081     {
00082         return 0;       
00083     }
00084 }

template<class T>
size_t Ig3DObjectCategory< T >::objects ( void   )  const [inline, virtual]

Definition at line 68 of file Ig3DObjectCategory.h.

References Ig3DObjectCategory< T >::m_objects.

Referenced by Ig3DObjectCategory< T >::clear().

00069 { return m_objects.size (); } 

template<class T>
void Ig3DObjectCategory< T >::registerBrowser ( IgState state,
Ig3DBaseBrowser  
) [inline, virtual]

Reimplemented in Ig3DAnimsCategory, Ig3DClipsCategory, Ig3DGridCategory, Ig3DLightsCategory, Ig3DSlicersCategory, and Ig3DViewpointsCategory.

Definition at line 169 of file Ig3DObjectCategory.h.

References IgControlCategory::registerMe().

Referenced by Ig3DLightsCategory::registerBrowser().

00171 {
00172     IgControlCategory::registerMe (state);
00173 }

template<class T>
void Ig3DObjectCategory< T >::remove ( size_t  index  )  [inline, virtual]

Definition at line 117 of file Ig3DObjectCategory.h.

References ASSERT, IgControlCategory::items(), Ig3DObjectCategory< T >::m_objects, and IgControlCategory::removeItem().

00118 {
00119     ASSERT (index != m_objects.size ());
00120     ASSERT (index != (size_t) items ());
00121     m_objects.erase (m_objects.begin () + index);
00122     removeItem (index);
00123 }

template<class T>
void Ig3DObjectCategory< T >::remove ( T *  object  )  [inline, virtual]

Definition at line 108 of file Ig3DObjectCategory.h.

References Ig3DObjectCategory< T >::find(), Ig3DObjectCategory< T >::m_objects, and IgControlCategory::removeItem().

00109 {
00110     size_t pos = find (object);
00111     m_objects.erase (m_objects.begin () + pos);
00112     removeItem (pos);
00113 }

template<class T>
void Ig3DObjectCategory< T >::rename ( size_t  index,
const QString &  newName 
) [inline, virtual]

Definition at line 149 of file Ig3DObjectCategory.h.

References ASSERT, Ig3DBaseModel::encode(), IgControlCategory::items(), and Ig3DObjectCategory< T >::m_objects.

00150 {
00151     ASSERT (index != m_objects.size ());
00152     ASSERT (index != (size_t) items ());
00153     m_objects[index]->setName 
00154       (Ig3DBaseModel::encode (newName.utf8 ().data ()));
00155 }

template<class T>
void Ig3DObjectCategory< T >::rename ( T *  object,
const QString &  newName 
) [inline, virtual]

Definition at line 141 of file Ig3DObjectCategory.h.

References Ig3DBaseModel::encode(), Ig3DObjectCategory< T >::find(), and Ig3DObjectCategory< T >::m_objects.

00142 {       
00143     m_objects[find (object)]->setName 
00144         (Ig3DBaseModel::encode (newName.utf8 ().data ())); 
00145 }

template<class T>
void Ig3DObjectCategory< T >::replace ( size_t  index,
T *  with 
) [inline, virtual]

Definition at line 132 of file Ig3DObjectCategory.h.

References ASSERT, IgControlCategory::items(), and Ig3DObjectCategory< T >::m_objects.

00133 {
00134     ASSERT (index != m_objects.size ());
00135     ASSERT (index != (size_t) items ());
00136     m_objects[index] = with;
00137 }

template<class T>
void Ig3DObjectCategory< T >::replace ( T *  object,
T *  with 
) [inline, virtual]

Definition at line 127 of file Ig3DObjectCategory.h.

References Ig3DObjectCategory< T >::find(), and Ig3DObjectCategory< T >::m_objects.

00128 { m_objects[find (object)] = with; }


Member Data Documentation

template<class T>
std::vector<T *> Ig3DObjectCategory< T >::m_objects [private]

Definition at line 53 of file Ig3DObjectCategory.h.

Referenced by Ig3DObjectCategory< T >::add(), Ig3DObjectCategory< T >::find(), Ig3DObjectCategory< T >::object(), Ig3DObjectCategory< T >::objects(), Ig3DObjectCategory< T >::remove(), Ig3DObjectCategory< T >::rename(), and Ig3DObjectCategory< T >::replace().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:24:59 2009 for CMSSW by  doxygen 1.5.4