ObjectHandler Namespace Reference

ObjectHandler. More...

Namespaces

 matrix
 Template function to convert a matrix from type property_t to type value_t.
 
 vector
 Template function to convert a vector from type property_t to type value_t.
 

Classes

struct  CallerDimensions
 The dimensions of the calling range. More...
 
struct  CallerType
 The environment which called the function that is currently running. More...
 
class  CallingRange
 Processing for the host cell of an Object. More...
 
class  Coerce
 Base class in support of datatype coercion. More...
 
class  Configuration
 Global configuration information specific to the Excel session. More...
 
class  ConvertOper
 Perform datatype conversions of OPERs. More...
 
class  Create
 Create the enumerated type associated with a string. More...
 
class  DefaultProcessor
 Default behavior for post serialization processing of an Object. More...
 
struct  empty_property_tag
 Placeholder for a null value. More...
 
class  EnumClassRegistry
 A concrete instantiation of the Registry class, for enumerated classes. More...
 
class  EnumPairRegistry
 A concrete instantiation of the Registry class, for "pairs". More...
 
class  EnumTypeRegistry
 A concrete instantiation of the Registry class, for enumerated types. More...
 
class  Exception
 Simple implementation of an exception. More...
 
class  FunctionCall
 Singleton encapsulating state relating to Excel function call. More...
 
class  Group
 A collection of Objects. More...
 
class  LibraryObject
 Customizes the Object class for most typical uses. More...
 
class  Logger
 Wrapper for the logging framework. More...
 
struct  LoopIteration
 Execute one iteration of the loop function. More...
 
struct  LoopIteration< LoopFunction, InputType, void >
 Partial specialization for LoopIteration where return type is void. More...
 
class  my_iless
 std::string specialized case insensitive version of less More...
 
class  Object
 Interface for Objects to be stored in the ObjectHandler Repository. More...
 
class  ObjectWrapper
 Container to ensure that Object references are updated. More...
 
class  ObjectWrapperXL
 Customization of the ObjectWrapper class for the Excel platform. More...
 
class  Observable
 Object that notifies its changes to a set of observers. More...
 
class  Observer
 Object that gets notified when a given observable changes. More...
 
class  Processor
 Restore the state of an Object after deserialization. More...
 
class  ProcessorFactory
 Manage all of the Processor objects which are defined for this environment. More...
 
class  property_t
 A value of variant type. More...
 
class  Range
 Container for a matrix of doubles. More...
 
class  RangeReference
 A utility class for parsing range references in string format. More...
 
class  Registry
 A registry of enumerated types and classes. More...
 
class  RegistryManager
 Manage access to an Enumeration Registry. More...
 
class  Repository
 Maintain a store of Objects. More...
 
class  RepositoryXL
 Excel-specific enhancements to the Repository class. More...
 
class  SerializationFactory
 A Singleton wrapping the boost::serialization interface. More...
 
class  Singleton
 Basic support for the singleton pattern. More...
 
class  ValueObject
 Capture the values of the arguments passed to the Object constructor. More...
 
struct  X
 
class  Xloper
 Perform RAII for Excel's XLOPER datatype. More...
 

Typedefs

typedef std::pair< std::string, std::string > KeyPair
 A pair of strings. More...
 
typedef boost::_bi::bind_t< ObjectHandler::property_t, boost::_mfi::cmf1< ObjectHandler::property_t, ObjectHandler::Object, const std::string & >, boost::_bi::list2< boost::_bi::value< boost::shared_ptr< ObjectHandler::Object > >, boost::arg< 1 > > > ohObjectPropertyValuesBind
 
typedef ObjectHandler::property_t(ObjectHandler::Object::* ohObjectPropertyValuesSignature) (const std::string &) const
 
typedef std::pair< std::string, boost::shared_ptr< Object > > StrObjectPair
 
typedef std::set< std::string > Category
 
typedef std::list< StrObjectPair > HandlesList
 
typedef boost::shared_ptr< ProcessorProcessorPtr
 
typedef boost::make_recursive_variant< empty_property_tag, bool, int, std::string, long, double, std::vector< boost::recursive_variant_ > >::type property_base
 The underlying types supported by property_t.
 

Functions

template<class ObjectClass >
std::vector< boost::shared_ptr< ObjectClass > > getObjectVector (const std::vector< std::string > &objectIDs, const int &nestingLevel=0, bool includeGroups=false)
 Convert a vector of Object IDs to a vector of objects.
 
template<class ObjectClass , class LibraryClass >
std::vector< boost::shared_ptr< LibraryClass > > getLibraryObjectVector (const std::vector< std::string > &objectIDs, const int &nestingLevel=0)
 Convert a vector of Object IDs to a vector of library objects.
 
std::string uppercase (const std::string &s)
 Convert a std::string to uppercase.
 
KeyPair uppercase (const KeyPair &s)
 Convert a KeyPair to uppercase.
 
std::ostream & operator<< (std::ostream &left, const KeyPair &right)
 Write a KeyPair to the given stream.
 
template<class T >
std::vector< T > vectorStringToEnum (const std::vector< std::string > ids, const std::string &paramName)
 Convert a list of strings into the associated enumerations.
 
std::ostream & operator<< (std::ostream &out, const boost::shared_ptr< Object > &object)
 Log the given Object to the given stream.
 
std::ostream & operator<< (std::ostream &out, const boost::shared_ptr< ObjectWrapper > &ow)
 Log the given ObjectWrapper to the given stream.
 
std::ostream & operator<< (std::ostream &out, const property_t &p)
 Log the given property_t value to the given stream.
 
std::ostream & operator<< (std::ostream &, const boost::shared_ptr< CallingRange > &)
 
template<class T >
void matrixToOper (const std::vector< std::vector< T > > &vv, OPER &xMatrix)
 Convert type std::vector<std::vector<T> > to an Excel OPER.
 
template<class T >
std::vector< std::vector< T > > operToMatrix (const OPER &xMatrix, const std::string &paramName)
 Helper template wrapper for operToMatrixImpl. More...
 
template<class T >
std::vector< std::vector< T > > operToMatrixImpl (const ConvertOper &xMatrix, const std::string &paramName)
 Convert a value of type ConvertOper to a matrix.
 
template<class T >
std::vector< std::vector< T > > fpToMatrix (const FP &fpMatrix)
 Convert an Excel FP to type std::vector<std::vector<T> >.
 
template<class T >
std::vector< T > operToVector (const OPER &xVector, const std::string &paramName)
 Helper template wrapper for operToVectorImpl. More...
 
template<class LibraryClass , class ObjectClass >
std::vector< boost::shared_ptr< LibraryClass > > operToObjectVector (const OPER &xVector, const std::string &paramName)
 Helper template wrapper for operToVectorImpl. More...
 
template<class T >
std::vector< T > operToVectorImpl (const ConvertOper &xVector, const std::string &paramName)
 Convert a value of type ConvertOper to a vector.
 
template<class T >
std::vector< T > fpToVector (const FP &fpVector)
 Convert an Excel FP to a std::vector of type T.
 
DLL_API void scalarToOper (const int &value, OPER &xInt, bool expandVector=true)
 Convert a int to an OPER.
 
DLL_API void scalarToOper (const long &value, OPER &xLong, bool expandVector=true)
 Convert a long to an OPER.
 
DLL_API void scalarToOper (const double &value, OPER &xDouble, bool expandVector=true)
 Convert a double to an OPER.
 
DLL_API void scalarToOper (const bool &value, OPER &xBoolean, bool expandVector=true)
 Convert a bool to an OPER.
 
DLL_API void scalarToOper (const char *value, OPER &xChar, bool expandVector=true)
 Convert a char * to an OPER.
 
DLL_API void scalarToOper (const std::string &value, OPER &xString, bool expandVector=true)
 Convert a string to an OPER.
 
DLL_API void scalarToOper (const property_t &value, OPER &xAny, bool expandVector=true)
 Convert a property_t to an OPER.
 
DLL_API void validateRange (const OPER *xRange, const std::string &name)
 Determine whether the given range contains an error value.
 
DLL_API void stringToChar (const std::string &, char *)
 Convert the std::string to the char*.
More...
 
template<class T >
void vectorToOper (const std::vector< T > &v, OPER &xVector)
 Wrapper for the other vectorToOper. More...
 
template<class T >
void vectorToOper (T begin, T end, OPER &xVector)
 Convert type std::vector<T> to an Excel OPER. More...
 
template<class LoopFunction , class InputType , class OutputType >
void loop (const boost::shared_ptr< FunctionCall > &functionCall, LoopFunction &loopFunction, OPER *xIn, XLOPER &xOut)
 Invoke the contained function once for each item in the input vector.
 
std::ostream & operator<< (std::ostream &, const RangeReference &)
 

Detailed Description

ObjectHandler.

Namespace for ObjectHandler functionality.

Typedef Documentation

◆ KeyPair

typedef std::pair<std::string, std::string> ObjectHandler::KeyPair

A pair of strings.

Derived class EnumPairRegistry instantiates base template class Registry with KeyPair instead of std::string, resulting in a structure in which enumerations are indexed by two strings instead of one.

Function Documentation

◆ convert2() [1/4]

template<class value_t , class container_t >
value_t ObjectHandler::convert2 ( const container_t &  c)

Convert the input value from type container_t to type value_t.

If the attempt fails then wrap the exception with additional info and rethrow.

◆ convert2() [2/4]

template<class value_t , class container_t >
value_t ObjectHandler::convert2 ( const container_t &  c,
const std::string &  parameterName 
)

Convert the input value from type container_t to type value_t.

This override allows the caller to specify the parameter name, which makes the error message clearer in the event of an error. Otherwise this function behaves the same as the one above.

◆ convert2() [3/4]

template<class value_t , class container_t >
value_t ObjectHandler::convert2 ( const container_t &  c,
const std::string &  parameterName,
const value_t &  defaultValue 
)

Convert the input value from type container_t to type value_t.

This function allows the caller to provide a default value in the event that the input is missing, which on Excel is true for inputs of type #NA.

◆ convert2() [4/4]

template<class value_t , class container_t >
value_t ObjectHandler::convert2 ( const container_t &  c,
const std::string &  parameterName,
const value_t &  defaultValue,
const value_t &  errorValue 
)

Convert the input value from type container_t to type value_t.

This function allows the caller to provide an error value which will be returned in the case of an exception. This function does not throw.

An error may occur in two cases:

  • If the input value has an error state. On Excel this is true for #NUM, #REF, etc.
  • If the attempted conversion throws.

◆ logAllObjects()

void ObjectHandler::logAllObjects ( )

Write all Objects to the log file.

Takes no action if the ObjectHandler repository is empty.

Examples
example.cpp.

◆ logObject()

void ObjectHandler::logObject ( const std::string &  objectID)

Write Object with given ID to log file.

Writes a warning message to the log file if no Object is found with the given ID.

Examples
example.cpp.

◆ logSetConsole()

void ObjectHandler::logSetConsole ( const int &  console = 0,
const int &  logLevel = 4 
)

Fork log messages to stdout.

Wraps function Logger::instance().setConsole().

This function is used in command-line environments and causes messages to appear both on the terminal and in the log file.

Examples
example.cpp.

◆ logSetFile()

std::string ObjectHandler::logSetFile ( const std::string &  logFileName,
const int &  logLevel = 4 
)

Start logging to file of given name.

Wraps function Logger::instance().logSetFile().

Examples
example.cpp.

◆ logSetLevel()

void ObjectHandler::logSetLevel ( const int &  logLevel)

Set the logging threshold.

Wraps function Logger::instance().setLogLevel().

It is seldom necessary to call this function as the default logging level is suitable for most purposes.

◆ logWriteMessage()

DLL_API void ObjectHandler::logWriteMessage ( const std::string &  message,
const int &  level = 4 
)

Write a message to the log file.

Wraps function Logger::instance().logMessage().

◆ operToMatrix()

template<class T >
std::vector<std::vector<T> > ObjectHandler::operToMatrix ( const OPER &  xMatrix,
const std::string &  paramName 
)

Helper template wrapper for operToMatrixImpl.

Accept an OPER as input and wrap this in class ConvertOper. This simplifies syntax in client applications.

◆ operToObjectVector()

template<class LibraryClass , class ObjectClass >
std::vector<boost::shared_ptr<LibraryClass> > ObjectHandler::operToObjectVector ( const OPER &  xVector,
const std::string &  paramName 
)

Helper template wrapper for operToVectorImpl.

  • Accept an OPER as input and wrap this in class ConvertOper
  • Specify VariantToScalarObject as the algorithm to be used

This simplifies syntax in client applications.

◆ operToVector()

template<class T >
std::vector<T> ObjectHandler::operToVector ( const OPER &  xVector,
const std::string &  paramName 
)

Helper template wrapper for operToVectorImpl.

  • Accept an OPER as input and wrap this in class ConvertOper
  • Specify VariantToScalar as the algorithm to be used

This simplifies syntax in client applications.

◆ stringToChar()

DLL_API void ObjectHandler::stringToChar ( const std::string &  ,
char *   
)

Convert the std::string to the char*.

Assumes that the caller has allocated XL_MAX_STR_LEN bytes for the char *.

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

◆ vectorToOper() [1/2]

template<class T >
void ObjectHandler::vectorToOper ( const std::vector< T > &  v,
OPER &  xVector 
)

Wrapper for the other vectorToOper.

Extracts the begin and end iterators of the input vector.

◆ vectorToOper() [2/2]

template<class T >
void ObjectHandler::vectorToOper ( begin,
end,
OPER &  xVector 
)

Convert type std::vector<T> to an Excel OPER.

The function sets the xlbitDLLFree bit.