utils::ObjectTable< T > Class Template Reference

This class enables caller to search between interface and object. It can store objects of the same class. More...

#include <interfaces_utils.h>

Inheritance diagram for utils::ObjectTable< T >:
Inheritance graph
[legend]
Collaboration diagram for utils::ObjectTable< T >:
Collaboration graph
[legend]

Public Member Functions

 ObjectTable ()
 ~ObjectTable ()
template<typename Arg >
bool add_interface (T *object)
 Put object into object table. Extract the interface pointer from object. Caller should make sure the static_cast<Arg *>(object) is OK.
bool query_interface (T *object, const char *name, void **return_ptr)
bool remove (T *object)
 Remove the object from object table.
template<typename Arg >
T * get_object (Arg *arg)
 Retrieve object from interface poiner.
 ObjectTable ()
 ~ObjectTable ()
template<typename Arg >
bool add_interface (T *object)
 Put object into object table. Extract the interface pointer from object. Caller should make sure the static_cast<Arg *>(object) is OK.
bool query_interface (T *object, const char *name, void **return_ptr)
bool remove (T *object)
 Remove the object from object table.
template<typename Arg >
T * get_object (Arg *arg)
 Retrieve object from interface poiner.
 ObjectTable ()
 ~ObjectTable ()
template<typename Arg >
bool add_interface (T *object)
 Put object into object table. Extract the interface pointer from object. Caller should make sure the static_cast<Arg *>(object) is OK.
bool query_interface (T *object, const char *name, void **return_ptr)
bool remove (T *object)
 Remove the object from object table.
template<typename Arg >
T * get_object (Arg *arg)
 Retrieve object from interface poiner.

Detailed Description

template<typename T>
class utils::ObjectTable< T >

This class enables caller to search between interface and object. It can store objects of the same class.

Definition at line 180 of file images/plugin_impl/interfaces_utils.h.


Constructor & Destructor Documentation

template<typename T>
utils::ObjectTable< T >::ObjectTable (  )  [inline]

Definition at line 183 of file images/plugin_impl/interfaces_utils.h.

00183 {}

template<typename T>
utils::ObjectTable< T >::~ObjectTable (  )  [inline]

Definition at line 184 of file images/plugin_impl/interfaces_utils.h.

00185     {
00186         unsigned int size = table_.size();
00187         if (size != 0)
00188         {
00189             ERRORPRINTF("ObjectTable for class %s not empty: size [%u]",
00190                         typeid(T).name(), size);
00191         }
00192     }

template<typename T>
utils::ObjectTable< T >::ObjectTable (  )  [inline]

Definition at line 183 of file pdf/plugin_impl/interfaces_utils.h.

00183 {}

template<typename T>
utils::ObjectTable< T >::~ObjectTable (  )  [inline]

Definition at line 184 of file pdf/plugin_impl/interfaces_utils.h.

00185     {
00186         unsigned int size = table_.size();
00187         if (size != 0)
00188         {
00189             ERRORPRINTF("ObjectTable for class %s not empty: size [%u]",
00190                         typeid(T).name(), size);
00191         }
00192     }

template<typename T>
utils::ObjectTable< T >::ObjectTable (  )  [inline]

Definition at line 183 of file plaintext/plugin_impl/interfaces_utils.h.

00183 {}

template<typename T>
utils::ObjectTable< T >::~ObjectTable (  )  [inline]

Definition at line 184 of file plaintext/plugin_impl/interfaces_utils.h.

00185     {
00186         unsigned int size = table_.size();
00187         if (size != 0)
00188         {
00189             ERRORPRINTF("ObjectTable for class %s not empty: size [%u]",
00190                         typeid(T).name(), size);
00191         }
00192     }


Member Function Documentation

template<typename T>
template<typename Arg >
bool utils::ObjectTable< T >::add_interface ( T *  object  )  [inline]

Put object into object table. Extract the interface pointer from object. Caller should make sure the static_cast<Arg *>(object) is OK.

Definition at line 200 of file plaintext/plugin_impl/interfaces_utils.h.

00201     {
00202         TableIter iter = table_.find(object);
00203         if (iter != table_.end())
00204         {
00205             iter->second->add_entry(static_cast<Arg *>(object));
00206         }
00207         else
00208         {
00209             InterfaceTablePtr ptr = new InterfaceTable;
00210             ptr->add_entry<Arg>(static_cast<Arg *>(object));
00211             table_[object] = ptr;
00212             unsigned int size = table_.size();
00213             if (size > MAX_OBJECTS)
00214             {
00215                 ERRORPRINTF("Too many objects for class %s: ObjectTable.size [%u] max [%u]",
00216                             typeid(T).name(), size, MAX_OBJECTS);
00217             }
00218         }
00219         return true;
00220     }

template<typename T>
template<typename Arg >
bool utils::ObjectTable< T >::add_interface ( T *  object  )  [inline]

Put object into object table. Extract the interface pointer from object. Caller should make sure the static_cast<Arg *>(object) is OK.

Definition at line 200 of file pdf/plugin_impl/interfaces_utils.h.

00201     {
00202         TableIter iter = table_.find(object);
00203         if (iter != table_.end())
00204         {
00205             iter->second->add_entry(static_cast<Arg *>(object));
00206         }
00207         else
00208         {
00209             InterfaceTablePtr ptr = new InterfaceTable;
00210             ptr->add_entry<Arg>(static_cast<Arg *>(object));
00211             table_[object] = ptr;
00212             unsigned int size = table_.size();
00213             if (size > MAX_OBJECTS)
00214             {
00215                 ERRORPRINTF("Too many objects for class %s: ObjectTable.size [%u] max [%u]",
00216                             typeid(T).name(), size, MAX_OBJECTS);
00217             }
00218         }
00219         return true;
00220     }

template<typename T>
template<typename Arg >
bool utils::ObjectTable< T >::add_interface ( T *  object  )  [inline]

Put object into object table. Extract the interface pointer from object. Caller should make sure the static_cast<Arg *>(object) is OK.

Definition at line 200 of file images/plugin_impl/interfaces_utils.h.

Referenced by text::PluginCollectionImpl::PluginCollectionImpl(), pdf::PluginCollectionImpl::PluginCollectionImpl(), images::PluginCollectionImpl::PluginCollectionImpl(), text::PluginDocImpl::PluginDocImpl(), pdf::PluginDocImpl::PluginDocImpl(), images::PluginDocImpl::PluginDocImpl(), text::PluginLibraryImpl::PluginLibraryImpl(), pdf::PluginLibraryImpl::PluginLibraryImpl(), images::PluginLibraryImpl::PluginLibraryImpl(), text::PluginRenderResultImpl::PluginRenderResultImpl(), pdf::PluginRenderResultImpl::PluginRenderResultImpl(), images::PluginRenderResultImpl::PluginRenderResultImpl(), text::PluginRenderSettingsImpl::PluginRenderSettingsImpl(), pdf::PluginRenderSettingsImpl::PluginRenderSettingsImpl(), images::PluginRenderSettingsImpl::PluginRenderSettingsImpl(), text::PluginSearchCriteria::PluginSearchCriteria(), pdf::PluginSearchCriteria::PluginSearchCriteria(), text::PluginViewImpl::PluginViewImpl(), pdf::PluginViewImpl::PluginViewImpl(), and images::PluginViewImpl::PluginViewImpl().

00201     {
00202         TableIter iter = table_.find(object);
00203         if (iter != table_.end())
00204         {
00205             iter->second->add_entry(static_cast<Arg *>(object));
00206         }
00207         else
00208         {
00209             InterfaceTablePtr ptr = new InterfaceTable;
00210             ptr->add_entry<Arg>(static_cast<Arg *>(object));
00211             table_[object] = ptr;
00212             unsigned int size = table_.size();
00213             if (size > MAX_OBJECTS)
00214             {
00215                 ERRORPRINTF("Too many objects for class %s: ObjectTable.size [%u] max [%u]",
00216                             typeid(T).name(), size, MAX_OBJECTS);
00217             }
00218         }
00219         return true;
00220     }

Here is the caller graph for this function:

template<typename T>
template<typename Arg >
T* utils::ObjectTable< T >::get_object ( Arg *  arg  )  [inline]

Retrieve object from interface poiner.

Definition at line 247 of file plaintext/plugin_impl/interfaces_utils.h.

00248     {
00249         TableIter begin = table_.begin();
00250         TableIter end   = table_.end();
00251         for(TableIter iter = begin; iter != end; ++iter)
00252         {
00253             if (iter->second->contain_interface(arg))
00254             {
00255                 return iter->first;
00256             }
00257         }
00258         assert(false);
00259         return 0;
00260     }

template<typename T>
template<typename Arg >
T* utils::ObjectTable< T >::get_object ( Arg *  arg  )  [inline]

Retrieve object from interface poiner.

Definition at line 247 of file pdf/plugin_impl/interfaces_utils.h.

00248     {
00249         TableIter begin = table_.begin();
00250         TableIter end   = table_.end();
00251         for(TableIter iter = begin; iter != end; ++iter)
00252         {
00253             if (iter->second->contain_interface(arg))
00254             {
00255                 return iter->first;
00256             }
00257         }
00258         assert(false);
00259         return 0;
00260     }

template<typename T>
template<typename Arg >
T* utils::ObjectTable< T >::get_object ( Arg *  arg  )  [inline]

Retrieve object from interface poiner.

Definition at line 247 of file images/plugin_impl/interfaces_utils.h.

Referenced by text::PluginRenderSettingsImpl::query_instance(), pdf::PluginRenderSettingsImpl::query_instance(), and images::PluginRenderSettingsImpl::query_instance().

00248     {
00249         TableIter begin = table_.begin();
00250         TableIter end   = table_.end();
00251         for(TableIter iter = begin; iter != end; ++iter)
00252         {
00253             if (iter->second->contain_interface(arg))
00254             {
00255                 return iter->first;
00256             }
00257         }
00258         assert(false);
00259         return 0;
00260     }

Here is the caller graph for this function:

template<typename T>
bool utils::ObjectTable< T >::query_interface ( T *  object,
const char *  name,
void **  return_ptr 
) [inline]

Definition at line 222 of file plaintext/plugin_impl/interfaces_utils.h.

00223     {
00224         TableIter iter = table_.find(object);
00225         if (iter != table_.end())
00226         {
00227             return iter->second->query_interface(name, return_ptr);
00228         }
00229         return false;
00230     }

template<typename T>
bool utils::ObjectTable< T >::query_interface ( T *  object,
const char *  name,
void **  return_ptr 
) [inline]

Definition at line 222 of file pdf/plugin_impl/interfaces_utils.h.

00223     {
00224         TableIter iter = table_.find(object);
00225         if (iter != table_.end())
00226         {
00227             return iter->second->query_interface(name, return_ptr);
00228         }
00229         return false;
00230     }

template<typename T>
bool utils::ObjectTable< T >::query_interface ( T *  object,
const char *  name,
void **  return_ptr 
) [inline]

Definition at line 222 of file images/plugin_impl/interfaces_utils.h.

00223     {
00224         TableIter iter = table_.find(object);
00225         if (iter != table_.end())
00226         {
00227             return iter->second->query_interface(name, return_ptr);
00228         }
00229         return false;
00230     }

template<typename T>
bool utils::ObjectTable< T >::remove ( T *  object  )  [inline]

Remove the object from object table.

Definition at line 233 of file plaintext/plugin_impl/interfaces_utils.h.

00234     {
00235         TableIter iter = table_.find(object);
00236         if (iter != table_.end())
00237         {
00238             delete iter->second;
00239             table_.erase(iter);
00240             return true;
00241         }
00242         return false;
00243     }

template<typename T>
bool utils::ObjectTable< T >::remove ( T *  object  )  [inline]

Remove the object from object table.

Definition at line 233 of file pdf/plugin_impl/interfaces_utils.h.

00234     {
00235         TableIter iter = table_.find(object);
00236         if (iter != table_.end())
00237         {
00238             delete iter->second;
00239             table_.erase(iter);
00240             return true;
00241         }
00242         return false;
00243     }

template<typename T>
bool utils::ObjectTable< T >::remove ( T *  object  )  [inline]

The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.2-20100208