ObjectHandler::RepositoryXL Class Reference

Excel-specific enhancements to the Repository class. More...

#include <ohxl/repositoryxl.hpp>

Inheritance diagram for ObjectHandler::RepositoryXL:
Collaboration diagram for ObjectHandler::RepositoryXL:

Public Member Functions

Object Management
virtual std::string storeObject (const std::string &objectID, const boost::shared_ptr< Object > &obj, bool overwrite=false, boost::shared_ptr< ValueObject > valueObject=boost::shared_ptr< ValueObject >())
 Wrapper for the storeObject function in the base class. More...
 
Error Messages
void logError (const std::string &message, const boost::shared_ptr< FunctionCall > &functionCall)
 Log an error message. More...
 
std::string retrieveError (const XLOPER *range)
 Retrieve the error associated with the given range.
 
std::string vbaError ()
 Retrieve the error associated with VBA.
 
void clearVbaError ()
 Clear any error associated with VBA.
 
void clearError ()
 Clear any error associated with the current range.
 
Logging
virtual void dump (std::ostream &)
 Write the entire contents of the RepositoryXL object to the given stream. More...
 
Garbage Collection
void collectGarbage (const bool &deletePermanent=false)
 Delete all objects orphaned by the deletion of the calling cell. More...
 
Calling Ranges
std::vector< std::string > callerAddress (const std::vector< std::string > &objectList)
 Retrieve list of cell addresses corresponding to object list.
 
std::vector< std::string > callerKey (const std::vector< std::string > &objectList)
 Retrieve keys of CallingRange objects associated with the given object list.
 
- Public Member Functions inherited from ObjectHandler::Repository
template<class T >
void retrieveObject (boost::shared_ptr< T > &ret, const std::string &id)
 Template member function to retrieve the Object with given ID. More...
 
void retrieveObject (boost::shared_ptr< Object > &ret, const std::string &id)
 Override of template function retrieveObject. More...
 
virtual boost::shared_ptr< ObjectretrieveObjectImpl (const std::string &objectID)
 Default implementation of retrieveObjectImpl. More...
 
virtual void deleteObject (const std::string &objectID)
 Delete the object with the given ID. More...
 
virtual void deleteObject (const std::vector< std::string > &objectIDs)
 Delete a list of objects with the given IDs. More...
 
virtual void deleteAllObjects (const bool &deletePermanent=false)
 Delete all of the Objects in the Repository. More...
 
virtual void dumpObject (const std::string &objectID, std::ostream &)
 Log the indicated Object to the given stream. More...
 
 Repository ()
 Constructor - initialize the singleton.
 
virtual ~Repository ()
 Destructor - de-initialize the singleton.
 
virtual int objectCount ()
 Count of all the Objects in the Repository.
 
virtual const std::vector< std::string > listObjectIDs (const std::string &regex="")
 List the IDs of all the Objects in the Repository. More...
 
virtual std::vector< bool > objectExists (const std::vector< std::string > &objectList)
 Indicate whether an Object with the given ID is found in the Repository.
 
virtual const std::vector< std::string > precedentIDs (const std::string &objectID)
 Retrieve the list of IDs of precedent objects.
 
virtual std::vector< double > creationTime (const std::vector< std::string > &objectList)
 The object's initial creation time.
 
virtual std::vector< double > updateTime (const std::vector< std::string > &objectList)
 The time of the object's last update.
 
virtual std::vector< bool > isPermanent (const std::vector< std::string > &objectList)
 get the object's permanent proterty
 
virtual const std::vector< std::string > className (const std::vector< std::string > &objectList)
 get the object's name
 

Static Members and Initialization / Finalization

static RepositoryXLinstance ()
 Client applications access the global object via a call to RepositoryXL::instance().
 
virtual void clear ()
 Clear the state of the Singleton. More...
 

get callername property

virtual std::vector< bool > isOrphan (const std::vector< std::string > &objectList)
 get the object property orphan
 
virtual std::vector< std::string > updateCounter (const std::vector< std::string > &objectList)
 Retrieve the object property Update Counter.
 
virtual std::string formatID (const std::string &objectID)
 Convert Excel-format Object IDs into the format recognized by the base Repository class. More...
 

Additional Inherited Members

- Public Types inherited from ObjectHandler::Repository
typedef std::map< std::string, boost::shared_ptr< ObjectWrapper >, my_ilessObjectMap
 Define the type of the structure used to store the Objects. More...
 
- Static Public Member Functions inherited from ObjectHandler::Repository
static Repositoryinstance ()
 Client applications access the global object via a call to Repository::instance().
 
- Protected Member Functions inherited from ObjectHandler::Repository
virtual const boost::shared_ptr< ObjectWrapper > & getObjectWrapper (const std::string &objectID) const
 Get the object ObjectWrapper from ObjectMap.
 
virtual void registerObserver (boost::shared_ptr< ObjectWrapper > objWrapper)
 Register an ObjectWrapper as an Observer of its precedents. More...
 
virtual bool objectExists (const std::string &objectID) const
 Indicate whether an Object with the given ID is found in the Repository.
 
virtual const std::vector< std::string > precedentIDs (const boost::shared_ptr< Group > &group)
 Retrieve the list of IDs of precedent objects containde in this group.
 
- Static Protected Attributes inherited from ObjectHandler::Repository
static Repositoryinstance_
 A pointer to the Repository instance, used to support the Singleton pattern.
 

Detailed Description

Excel-specific enhancements to the Repository class.

Extends the base Repository class to work with ObjectWrapperXL instead of Object, and to provide other functionality specific to the Excel platform.

Examples
addinstatic.cpp.

Member Function Documentation

◆ clear()

virtual void ObjectHandler::RepositoryXL::clear ( )
virtual

Clear the state of the Singleton.

Clients of this class must ensure that the function below is called from the xlAutoClose() function, before xlFree is called on the XLL instance. Failure to do so may result in an access violation as the RepositoryXL destructor attempts to call in to the Excel C API after it has been de-initialized.

Examples
addinstatic.cpp.

◆ collectGarbage()

void ObjectHandler::RepositoryXL::collectGarbage ( const bool &  deletePermanent = false)

Delete all objects orphaned by the deletion of the calling cell.

By default this function does not delete permanent objects. Setting deletePermanent to true causes permanent objects to be garbage collected as well.

◆ dump()

virtual void ObjectHandler::RepositoryXL::dump ( std::ostream &  )
virtual

Write the entire contents of the RepositoryXL object to the given stream.

Call the corresponding function in the base class, then output additional info specific to the Excel platform, e.g. information on CallingRange objects.

Reimplemented from ObjectHandler::Repository.

◆ formatID()

virtual std::string ObjectHandler::RepositoryXL::formatID ( const std::string &  objectID)
protectedvirtual

Convert Excel-format Object IDs into the format recognized by the base Repository class.

The functiong will be used in derived class(e.g in class repositoryXL it will change the objectID custom_#0001 into custom);

Reimplemented from ObjectHandler::Repository.

◆ logError()

void ObjectHandler::RepositoryXL::logError ( const std::string &  message,
const boost::shared_ptr< FunctionCall > &  functionCall 
)

Log an error message.

Normally the global FunctionCall object is accessed by its Singleton interface e.g. FunctionCall.instance().xxx(). In this specific case function logError() accepts instead a direct reference to the FunctionCall object as instantiated by the client. This is required to ensure exception safety in the event that the FunctionCall constructor itself has thrown an exception.

This function never throws.

Examples
addindynamic1.cpp, addindynamic2.cpp, and addinstatic.cpp.

◆ storeObject()

virtual std::string ObjectHandler::RepositoryXL::storeObject ( const std::string &  objectID,
const boost::shared_ptr< Object > &  obj,
bool  overwrite = false,
boost::shared_ptr< ValueObject valueObject = boost::shared_ptr< ValueObject >() 
)
virtual

Wrapper for the storeObject function in the base class.

Initialize the CallingRange object associated with the new ObjectWrapperXL object. Perform a test to ensure that an object from one cell cannot overwrite an object in another cell with the same ID.

Reimplemented from ObjectHandler::Repository.

Examples
addindynamic1.cpp, and addinstatic.cpp.

The documentation for this class was generated from the following file: