54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
#ifndef __LOUT_OBJECTX_HH__
|
|
#define __LOUT_OBJECTX_HH__
|
|
|
|
#include <memory>
|
|
#include <typeindex>
|
|
#include <exception>
|
|
#include <stdexcept>
|
|
#include <vector>
|
|
#include <map>
|
|
|
|
#include "object.hh"
|
|
#include "container.hh"
|
|
#include "signal.hh"
|
|
|
|
namespace lout {
|
|
|
|
/**
|
|
* \brief This was a poor man's RTTI implementation.
|
|
*/
|
|
namespace identity {
|
|
|
|
/**
|
|
* Hooks for class name inspection.
|
|
*
|
|
* It began life as an RTTI clone. It did not support multiple inheritance.
|
|
*
|
|
* It appeared to be a model of Java's `Object` system. It's mostly been migrated
|
|
* to use C++ RTTI and most use cases should be avoiding the `lout::contaner` stuff.
|
|
*/
|
|
class IdentifiableObject: public object::Object
|
|
{
|
|
private:
|
|
// TODO: Use the Alepha facility for this, eventually...
|
|
static std::map< std::type_index, std::string > classNames;
|
|
|
|
protected:
|
|
void registerName (const char *className, std::type_index index);
|
|
|
|
public:
|
|
void intoStringBuffer(misc::StringBuffer *sb) const override;
|
|
|
|
/**
|
|
* \brief Return the name, under which the class of this object was
|
|
* registered.
|
|
*/
|
|
const char *getClassName() const { return classNames.at( typeid( *this ) ).c_str(); }
|
|
};
|
|
|
|
} // namespace identity
|
|
|
|
} // namespace lout
|
|
|
|
#endif // __LOUT_OBJECTX_HH__
|