*/
class I2_BASE_API Application : public ObjectImpl<Application> {
public:
- DECLARE_PTR_TYPEDEFS(Application);
+ DECLARE_OBJECT(Application);
static boost::signals2::signal<void (void)> OnReopenLogs;
class I2_BASE_API Array : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(Array);
+ DECLARE_OBJECT(Array);
/**
* An iterator that can be used to iterate over array elements.
class I2_BASE_API Dictionary : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(Dictionary);
+ DECLARE_OBJECT(Dictionary);
/**
* An iterator that can be used to iterate over dictionary elements.
class I2_BASE_API DynamicObject : public ObjectImpl<DynamicObject>
{
public:
- DECLARE_PTR_TYPEDEFS(DynamicObject);
+ DECLARE_OBJECT(DynamicObject);
static boost::signals2::signal<void (const DynamicObject::Ptr&)> OnStarted;
static boost::signals2::signal<void (const DynamicObject::Ptr&)> OnStopped;
DebugInfo m_DebugInfo;
};
-#define DECLARE_TYPENAME(klass) \
+#define DECLARE_OBJECTNAME(klass) \
inline static String GetTypeName(void) \
{ \
return #klass; \
DynamicType::TypeMap::const_iterator tt = InternalGetTypeMap().find(name);
if (tt == InternalGetTypeMap().end()) {
- const Type *type = Type::GetByName(name);
+ Type::Ptr type = Type::GetByName(name);
if (!type || !Type::GetByName("DynamicObject")->IsAssignableFrom(type)
|| type->IsAbstract())
{
ASSERT(!OwnsLock());
- const Type *type = Type::GetByName(m_Name);
+ Type::Ptr type = Type::GetByName(m_Name);
Object::Ptr object = type->Instantiate();
class I2_BASE_API DynamicType : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(DynamicType);
+ DECLARE_OBJECT(DynamicType);
DynamicType(const String& name);
class I2_BASE_API FIFO : public Stream
{
public:
- DECLARE_PTR_TYPEDEFS(FIFO);
+ DECLARE_OBJECT(FIFO);
static const size_t BlockSize = 16 * 1024;
class I2_BASE_API FileLogger : public ObjectImpl<FileLogger>
{
public:
- DECLARE_PTR_TYPEDEFS(FileLogger);
- DECLARE_TYPENAME(FileLogger);
+ DECLARE_OBJECT(FileLogger);
+ DECLARE_OBJECTNAME(FileLogger);
static Value StatsFunc(Dictionary::Ptr& status, Array::Ptr& perfdata);
class I2_BASE_API Logger : public ObjectImpl<Logger>
{
public:
- DECLARE_PTR_TYPEDEFS(Logger);
+ DECLARE_OBJECT(Logger);
static String SeverityToString(LogSeverity severity);
static LogSeverity StringToSeverity(const String& severity);
class I2_BASE_API NetworkStream : public Stream
{
public:
- DECLARE_PTR_TYPEDEFS(NetworkStream);
+ DECLARE_OBJECT(NetworkStream);
NetworkStream(const Socket::Ptr& socket);
using namespace icinga;
+REGISTER_PRIMITIVE_TYPE(Object);
+
#ifdef _DEBUG
boost::mutex Object::m_DebugMutex;
#endif /* _DEBUG */
return m_Object;
}
-const Type *Object::GetReflectionType(void) const
-{
- return NULL;
-}
-
void Object::SetField(int, const Value&)
{
BOOST_THROW_EXCEPTION(std::runtime_error("Invalid field ID."));
BOOST_THROW_EXCEPTION(std::runtime_error("Invalid field ID."));
}
+Type::Ptr icinga::LookupType(const char *name)
+{
+ return Type::GetByName(name);
+}
+
typedef shared_ptr<klass> Ptr; \
typedef weak_ptr<klass> WeakPtr
+#define IMPL_TYPE_LOOKUP(klass) \
+ inline virtual shared_ptr<Type> GetReflectionType(void) const \
+ { \
+ return LookupType(#klass); \
+ }
+
+#define DECLARE_OBJECT(klass) \
+ DECLARE_PTR_TYPEDEFS(klass); \
+ IMPL_TYPE_LOOKUP(klass);
+
class Type;
+I2_BASE_API shared_ptr<Type> LookupType(const char *name);
+
/**
* Base class for all heap-allocated objects. At least one of its methods
* has to be virtual for RTTI to work.
class I2_BASE_API Object : public enable_shared_from_this<Object>
{
public:
- DECLARE_PTR_TYPEDEFS(Object);
+ DECLARE_OBJECT(Object);
Object(void);
virtual ~Object(void);
- virtual const Type *GetReflectionType(void) const;
virtual void SetField(int id, const Value& value);
virtual Value GetField(int id) const;
return m_Name;
}
-const Type *PrimitiveType::GetBaseType(void) const
+Type::Ptr PrimitiveType::GetBaseType(void) const
{
- return NULL;
+ return Type::Ptr();
}
int PrimitiveType::GetAttributes(void) const
PrimitiveType(const String& name);
virtual String GetName(void) const;
- virtual const Type *GetBaseType(void) const;
+ virtual Type::Ptr GetBaseType(void) const;
virtual int GetAttributes(void) const;
virtual int GetFieldId(const String& name) const;
virtual Field GetFieldInfo(int id) const;
namespace { namespace UNIQUE_NAME(prt) { \
void RegisterPrimitiveType ## type(void) \
{ \
- icinga::Type *t = new PrimitiveType(#type); \
+ icinga::Type::Ptr t = make_shared<PrimitiveType>(#type); \
icinga::Type::Register(t); \
} \
\
class I2_BASE_API Process : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(Process);
+ DECLARE_OBJECT(Process);
#ifdef _WIN32
typedef String Arguments;
class I2_BASE_API RingBuffer : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(RingBuffer);
+ DECLARE_OBJECT(RingBuffer);
typedef std::vector<int>::size_type SizeType;
class I2_BASE_API ScriptFunction : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(ScriptFunction);
+ DECLARE_OBJECT(ScriptFunction);
typedef boost::function<Value (const std::vector<Value>& arguments)> Callback;
REGISTER_SCRIPTFUNCTION(log, &ScriptUtils::Log);
REGISTER_SCRIPTFUNCTION(range, &ScriptUtils::Range);
REGISTER_SCRIPTFUNCTION(exit, &ScriptUtils::Exit);
+REGISTER_SCRIPTFUNCTION(typeof, &ScriptUtils::TypeOf);
bool ScriptUtils::Regex(const String& pattern, const String& text)
{
{
exit(code);
}
+
+Type::Ptr ScriptUtils::TypeOf(const Value& value)
+{
+ switch (value.GetType()) {
+ case ValueEmpty:
+ return Type::GetByName("Object");
+ case ValueNumber:
+ return Type::GetByName("double");
+ case ValueString:
+ return Type::GetByName("String");
+ case ValueObject:
+ return static_cast<Object::Ptr>(value)->GetReflectionType();
+ default:
+ VERIFY(!"Invalid value type.");
+ }
+}
static void Log(const std::vector<Value>& arguments);
static Array::Ptr Range(const std::vector<Value>& arguments);
static void Exit(int code);
+ static Type::Ptr TypeOf(const Value& value);
private:
ScriptUtils(void);
class I2_BASE_API ScriptVariable : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(ScriptVariable);
+ DECLARE_OBJECT(ScriptVariable);
ScriptVariable(const Value& data);
static Object::Ptr SerializeObject(const Object::Ptr& input, int attributeTypes)
{
- const Type *type = input->GetReflectionType();
+ Type::Ptr type = input->GetReflectionType();
VERIFY(type);
static Object::Ptr DeserializeObject(const Object::Ptr& object, const Dictionary::Ptr& input, bool safe_mode, int attributeTypes)
{
- const Type *type;
-
if (!object && safe_mode)
BOOST_THROW_EXCEPTION(std::runtime_error("Tried to instantiate object while safe mode is enabled."));
+ Type::Ptr type;
+
if (object)
type = object->GetReflectionType();
else
class I2_BASE_API Socket : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(Socket);
+ DECLARE_OBJECT(Socket);
Socket(void);
Socket(SOCKET fd);
class I2_BASE_API StatsFunction : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(StatsFunction);
+ DECLARE_OBJECT(StatsFunction);
typedef boost::function<Value (Dictionary::Ptr& status, Array::Ptr& perfdata)> Callback;
class I2_BASE_API StdioStream : public Stream
{
public:
- DECLARE_PTR_TYPEDEFS(StdioStream);
+ DECLARE_OBJECT(StdioStream);
StdioStream(std::iostream *innerStream, bool ownsStream);
~StdioStream(void);
class I2_BASE_API Stream : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(Stream);
+ DECLARE_OBJECT(Stream);
/**
* Reads data from the stream.
class I2_BASE_API StreamLogger : public ObjectImpl<StreamLogger>
{
public:
- DECLARE_PTR_TYPEDEFS(StreamLogger);
+ DECLARE_OBJECT(StreamLogger);
virtual void Start(void);
virtual void Stop(void);
class I2_BASE_API SyslogLogger : public ObjectImpl<SyslogLogger>
{
public:
- DECLARE_PTR_TYPEDEFS(SyslogLogger);
- DECLARE_TYPENAME(SyslogLogger);
+ DECLARE_OBJECT(SyslogLogger);
+ DECLARE_OBJECTNAME(SyslogLogger);
static Value StatsFunc(Dictionary::Ptr& status, Array::Ptr& perfdata);
class I2_BASE_API TcpSocket : public Socket
{
public:
- DECLARE_PTR_TYPEDEFS(TcpSocket);
+ DECLARE_OBJECT(TcpSocket);
void Bind(const String& service, int family);
void Bind(const String& node, const String& service, int family);
class I2_BASE_API Timer : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(Timer);
+ DECLARE_OBJECT(Timer);
Timer(void);
~Timer(void);
class I2_BASE_API TlsStream : public Stream
{
public:
- DECLARE_PTR_TYPEDEFS(TlsStream);
+ DECLARE_OBJECT(TlsStream);
TlsStream(const Socket::Ptr& socket, ConnectionRole role, const shared_ptr<SSL_CTX>& sslContext);
return types;
}
-void Type::Register(const Type *type)
+void Type::Register(const Type::Ptr& type)
{
VERIFY(GetByName(type->GetName()) == NULL);
GetTypes()[type->GetName()] = type;
}
-const Type *Type::GetByName(const String& name)
+Type::Ptr Type::GetByName(const String& name)
{
- std::map<String, const Type *>::const_iterator it;
+ std::map<String, Type::Ptr>::const_iterator it;
it = GetTypes().find(name);
if (it == GetTypes().end())
- return NULL;
+ return Type::Ptr();
return it->second;
}
return ((GetAttributes() & TAAbstract) != 0);
}
-bool Type::IsAssignableFrom(const Type *other) const
+bool Type::IsAssignableFrom(const Type::Ptr& other) const
{
- for (const Type *t = other; t; t = t->GetBaseType()) {
- if (t == this)
+ for (Type::Ptr t = other; t; t = t->GetBaseType()) {
+ if (t.get() == this)
return true;
}
struct Field
{
int ID;
- const Type *FType;
+ shared_ptr<Type> FType;
const char *Name;
int Attributes;
- Field(int id, const Type *type, const char *name, int attributes)
+ Field(int id, const shared_ptr<Type>& type, const char *name, int attributes)
: ID(id), FType(type), Name(name), Attributes(attributes)
{ }
};
TAAbstract = 1
};
-class I2_BASE_API Type
+class I2_BASE_API Type : public Object
{
public:
+ DECLARE_OBJECT(Type);
+
typedef boost::function<Object::Ptr (void)> Factory;
virtual String GetName(void) const = 0;
- virtual const Type *GetBaseType(void) const = 0;
+ virtual Type::Ptr GetBaseType(void) const = 0;
virtual int GetAttributes(void) const = 0;
virtual int GetFieldId(const String& name) const = 0;
virtual Field GetFieldInfo(int id) const = 0;
Object::Ptr Instantiate(void) const;
- bool IsAssignableFrom(const Type *other) const;
+ bool IsAssignableFrom(const Type::Ptr& other) const;
bool IsAbstract(void) const;
- static void Register(const Type *type);
- static const Type *GetByName(const String& name);
+ static void Register(const Type::Ptr& type);
+ static Type::Ptr GetByName(const String& name);
void SetFactory(const Factory& factory);
private:
- typedef std::map<String, const Type *> TypeMap;
+ typedef std::map<String, Type::Ptr> TypeMap;
static TypeMap& GetTypes(void);
namespace { namespace UNIQUE_NAME(rt) { \
void RegisterType ## type(void) \
{ \
- icinga::Type *t = new TypeImpl<type>(); \
+ icinga::Type::Ptr t = make_shared<TypeImpl<type> >(); \
t->SetFactory(FactoryHelper<type>().GetFactory()); \
icinga::Type::Register(t); \
} \
class I2_BASE_API UnixSocket : public Socket
{
public:
- DECLARE_PTR_TYPEDEFS(UnixSocket);
+ DECLARE_OBJECT(UnixSocket);
UnixSocket(void);
String Value::GetTypeName(void) const
{
- const Type *t;
+ Type::Ptr t;
switch (GetType()) {
case ValueEmpty:
class CheckerComponent : public ObjectImpl<CheckerComponent>
{
public:
- DECLARE_PTR_TYPEDEFS(CheckerComponent);
- DECLARE_TYPENAME(CheckerComponent);
+ DECLARE_OBJECT(CheckerComponent);
+ DECLARE_OBJECTNAME(CheckerComponent);
typedef boost::multi_index_container<
Checkable::Ptr,
return result;
}
-std::vector<String> icinga::GetFieldCompletionSuggestions(const Type *type, const String& word)
+std::vector<String> icinga::GetFieldCompletionSuggestions(const Type::Ptr& type, const String& word)
{
std::vector<String> result;
#include "cli/i2-cli.hpp"
#include "base/value.hpp"
#include "base/utility.hpp"
+#include "base/type.hpp"
#include <vector>
#include <boost/program_options.hpp>
{
std::vector<String> I2_CLI_API GetBashCompletionSuggestions(const String& type, const String& word);
-std::vector<String> I2_CLI_API GetFieldCompletionSuggestions(const Type *type, const String& word);
+std::vector<String> I2_CLI_API GetFieldCompletionSuggestions(const Type::Ptr& type, const String& word);
enum ImpersonationLevel
{
class I2_CLI_API CLICommand : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(CLICommand);
+ DECLARE_OBJECT(CLICommand);
typedef std::vector<String>(*ArgumentCompletionCallback)(const String&, const String&);
class DaemonCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(DaemonCommand);
+ DECLARE_OBJECT(DaemonCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class FeatureDisableCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(FeatureDisableCommand);
+ DECLARE_OBJECT(FeatureDisableCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class FeatureEnableCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(FeatureEnableCommand);
+ DECLARE_OBJECT(FeatureEnableCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class FeatureListCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(FeatureListCommand);
+ DECLARE_OBJECT(FeatureListCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class NodeAddCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(NodeAddCommand);
+ DECLARE_OBJECT(NodeAddCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class I2_CLI_API BlackAndWhitelistCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(BlackAndWhitelistCommand);
+ DECLARE_OBJECT(BlackAndWhitelistCommand);
BlackAndWhitelistCommand(const String& type, BlackAndWhitelistCommandType command);
class NodeListCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(NodeListCommand);
+ DECLARE_OBJECT(NodeListCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class NodeRemoveCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(NodeRemoveCommand);
+ DECLARE_OBJECT(NodeRemoveCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class NodeSetCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(NodeSetCommand);
+ DECLARE_OBJECT(NodeSetCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class NodeSetupCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(NodeSetupCommand);
+ DECLARE_OBJECT(NodeSetupCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class NodeUpdateConfigCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(NodeUpdateConfigCommand);
+ DECLARE_OBJECT(NodeUpdateConfigCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class NodeWizardCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(NodeWizardCommand);
+ DECLARE_OBJECT(NodeWizardCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class ObjectListCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(ObjectListCommand);
+ DECLARE_OBJECT(ObjectListCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class PKINewCACommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(PKINewCACommand);
+ DECLARE_OBJECT(PKINewCACommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class PKINewCertCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(PKINewCertCommand);
+ DECLARE_OBJECT(PKINewCertCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class PKIRequestCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(PKIRequestCommand);
+ DECLARE_OBJECT(PKIRequestCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class PKISaveCertCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(PKISaveCertCommand);
+ DECLARE_OBJECT(PKISaveCertCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class PKISignCSRCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(PKISignCSRCommand);
+ DECLARE_OBJECT(PKISignCSRCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class PKITicketCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(PKITicketCommand);
+ DECLARE_OBJECT(PKITicketCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class RepositoryClearChangesCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(RepositoryClearChangesCommand);
+ DECLARE_OBJECT(RepositoryClearChangesCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class RepositoryCommitCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(RepositoryCommitCommand);
+ DECLARE_OBJECT(RepositoryCommitCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
{
if (m_Command == RepositoryCommandAdd) {
Utility::LoadExtensionLibrary("icinga");
- const Type *ptype = Type::GetByName(m_Type);
+ Type::Ptr ptype = Type::GetByName(m_Type);
ASSERT(ptype);
return GetFieldCompletionSuggestions(ptype, word);
} else if (m_Command == RepositoryCommandRemove) {
class I2_CLI_API RepositoryObjectCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(RepositoryObjectCommand);
+ DECLARE_OBJECT(RepositoryObjectCommand);
RepositoryObjectCommand(const String& type, RepositoryCommandType command);
class VariableGetCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(VariableGetCommand);
+ DECLARE_OBJECT(VariableGetCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class VariableListCommand : public CLICommand
{
public:
- DECLARE_PTR_TYPEDEFS(VariableListCommand);
+ DECLARE_OBJECT(VariableListCommand);
virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const;
class CheckResultReader : public ObjectImpl<CheckResultReader>
{
public:
- DECLARE_PTR_TYPEDEFS(CheckResultReader);
- DECLARE_TYPENAME(CheckResultReader);
+ DECLARE_OBJECT(CheckResultReader);
+ DECLARE_OBJECTNAME(CheckResultReader);
static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
class CompatLogger : public ObjectImpl<CompatLogger>
{
public:
- DECLARE_PTR_TYPEDEFS(CompatLogger);
- DECLARE_TYPENAME(CompatLogger);
+ DECLARE_OBJECT(CompatLogger);
+ DECLARE_OBJECTNAME(CompatLogger);
static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
class ExternalCommandListener : public ObjectImpl<ExternalCommandListener>
{
public:
- DECLARE_PTR_TYPEDEFS(ExternalCommandListener);
- DECLARE_TYPENAME(ExternalCommandListener);
+ DECLARE_OBJECT(ExternalCommandListener);
+ DECLARE_OBJECTNAME(ExternalCommandListener);
static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
class StatusDataWriter : public ObjectImpl<StatusDataWriter>
{
public:
- DECLARE_PTR_TYPEDEFS(StatusDataWriter);
- DECLARE_TYPENAME(StatusDataWriter);
+ DECLARE_OBJECT(StatusDataWriter);
+ DECLARE_OBJECTNAME(StatusDataWriter);
static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
String name = m_Name;
if (!m_Abstract) {
- const NameComposer *nc = dynamic_cast<const NameComposer *>(Type::GetByName(m_Type));
+ shared_ptr<NameComposer> nc = dynamic_pointer_cast<NameComposer>(Type::GetByName(m_Type));
if (nc) {
name = nc->MakeName(m_Name, m_Properties);
/* If this is a non-abstract object we need to figure out
* its real name now - or assign it a temporary name. */
if (!m_Abstract) {
- const NameComposer *nc = dynamic_cast<const NameComposer *>(Type::GetByName(m_Type));
+ shared_ptr<NameComposer> nc = dynamic_pointer_cast<NameComposer>(Type::GetByName(m_Type));
if (nc) {
name = nc->MakeName(m_Name, Dictionary::Ptr());
*/
class I2_CONFIG_API ConfigItem : public Object {
public:
- DECLARE_PTR_TYPEDEFS(ConfigItem);
+ DECLARE_OBJECT(ConfigItem);
ConfigItem(const String& type, const String& name, bool abstract,
const Expression::Ptr& exprl, const DebugInfo& debuginfo,
class I2_CONFIG_API ConfigItemBuilder : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(ConfigItemBuilder);
+ DECLARE_OBJECT(ConfigItemBuilder);
ConfigItemBuilder(void);
explicit ConfigItemBuilder(const DebugInfo& debugInfo);
*/\r
class I2_CONFIG_API ConfigType : public Object {\r
public:\r
- DECLARE_PTR_TYPEDEFS(ConfigType);\r
+ DECLARE_OBJECT(ConfigType);\r
\r
ConfigType(const String& name, const DebugInfo& debuginfo);\r
\r
return arr->Get(index);
} else if (value.IsObjectType<Object>()) {
Object::Ptr object = value;
- const Type *type = object->GetReflectionType();
+ Type::Ptr type = object->GetReflectionType();
if (!type)
BOOST_THROW_EXCEPTION(ConfigError("Dot operator applied to object which does not support reflection"));
String checkName = name;
if (!abstract) {
- const NameComposer *nc = dynamic_cast<const NameComposer *>(Type::GetByName(type));
+ shared_ptr<NameComposer> nc = dynamic_pointer_cast<NameComposer>(Type::GetByName(type));
if (nc)
checkName = nc->MakeName(name, Dictionary::Ptr());
class I2_CONFIG_API Expression : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(Expression);
+ DECLARE_OBJECT(Expression);
typedef Value (*OpCallback)(const Expression *, const Dictionary::Ptr&, DebugHint *dhint);
class I2_CONFIG_API TypeRuleList : public Object\r
{\r
public:\r
- DECLARE_PTR_TYPEDEFS(TypeRuleList);\r
+ DECLARE_OBJECT(TypeRuleList);\r
\r
void SetValidator(const String& validator);\r
String GetValidator(void) const;\r
class CommandDbObject : public DbObject
{
public:
- DECLARE_PTR_TYPEDEFS(CommandDbObject);
+ DECLARE_OBJECT(CommandDbObject);
CommandDbObject(const shared_ptr<DbType>& type, const String& name1, const String& name2);
class I2_DB_IDO_API DbConnection : public ObjectImpl<DbConnection>
{
public:
- DECLARE_PTR_TYPEDEFS(DbConnection);
+ DECLARE_OBJECT(DbConnection);
static void StaticInitialize(void);
class I2_DB_IDO_API DbObject : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(DbObject);
+ DECLARE_OBJECT(DbObject);
static void StaticInitialize(void);
class I2_DB_IDO_API DbType : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(DbType);
+ DECLARE_OBJECT(DbType);
typedef boost::function<shared_ptr<DbObject> (const shared_ptr<DbType>&, const String&, const String&)> ObjectFactory;
typedef std::map<String, DbType::Ptr> TypeMap;
struct I2_DB_IDO_API DbValue : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(DbValue);
+ DECLARE_OBJECT(DbValue);
DbValue(DbValueType type, const Value& value);
class EndpointDbObject : public DbObject
{
public:
- DECLARE_PTR_TYPEDEFS(EndpointDbObject);
+ DECLARE_OBJECT(EndpointDbObject);
EndpointDbObject(const shared_ptr<DbType>& type, const String& name1, const String& name2);
class HostDbObject : public DbObject
{
public:
- DECLARE_PTR_TYPEDEFS(HostDbObject);
+ DECLARE_OBJECT(HostDbObject);
HostDbObject(const DbType::Ptr& type, const String& name1, const String& name2);
class HostGroupDbObject : public DbObject
{
public:
- DECLARE_PTR_TYPEDEFS(HostGroupDbObject);
+ DECLARE_OBJECT(HostGroupDbObject);
HostGroupDbObject(const DbType::Ptr& type, const String& name1, const String& name2);
class ServiceDbObject : public DbObject
{
public:
- DECLARE_PTR_TYPEDEFS(ServiceDbObject);
+ DECLARE_OBJECT(ServiceDbObject);
ServiceDbObject(const DbType::Ptr& type, const String& name1, const String& name2);
class ServiceGroupDbObject : public DbObject
{
public:
- DECLARE_PTR_TYPEDEFS(ServiceGroupDbObject);
+ DECLARE_OBJECT(ServiceGroupDbObject);
ServiceGroupDbObject(const DbType::Ptr& type, const String& name1, const String& name2);
class TimePeriodDbObject : public DbObject
{
public:
- DECLARE_PTR_TYPEDEFS(TimePeriodDbObject);
+ DECLARE_OBJECT(TimePeriodDbObject);
TimePeriodDbObject(const DbType::Ptr& type, const String& name1, const String& name2);
class UserDbObject : public DbObject
{
public:
- DECLARE_PTR_TYPEDEFS(UserDbObject);
+ DECLARE_OBJECT(UserDbObject);
UserDbObject(const DbType::Ptr& type, const String& name1, const String& name2);
class UserGroupDbObject : public DbObject
{
public:
- DECLARE_PTR_TYPEDEFS(UserGroupDbObject);
+ DECLARE_OBJECT(UserGroupDbObject);
UserGroupDbObject(const DbType::Ptr& type, const String& name1, const String& name2);
class IdoMysqlConnection : public ObjectImpl<IdoMysqlConnection>
{
public:
- DECLARE_PTR_TYPEDEFS(IdoMysqlConnection);
- DECLARE_TYPENAME(IdoMysqlConnection);
+ DECLARE_OBJECT(IdoMysqlConnection);
+ DECLARE_OBJECTNAME(IdoMysqlConnection);
static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
class IdoPgsqlConnection : public ObjectImpl<IdoPgsqlConnection>
{
public:
- DECLARE_PTR_TYPEDEFS(IdoPgsqlConnection);
- DECLARE_TYPENAME(IdoPgsqlConnection);
+ DECLARE_OBJECT(IdoPgsqlConnection);
+ DECLARE_OBJECTNAME(IdoPgsqlConnection);
static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
class Demo : public ObjectImpl<Demo>
{
public:
- DECLARE_PTR_TYPEDEFS(Demo);
- DECLARE_TYPENAME(Demo);
+ DECLARE_OBJECT(Demo);
+ DECLARE_OBJECTNAME(Demo);
virtual void Start(void);
class Hello : public ObjectImpl<Hello>
{
public:
- DECLARE_PTR_TYPEDEFS(Hello);
- DECLARE_TYPENAME(Hello);
+ DECLARE_OBJECT(Hello);
+ DECLARE_OBJECTNAME(Hello);
int Main(void);
};
class I2_ICINGA_API Checkable : public ObjectImpl<Checkable>
{
public:
- DECLARE_PTR_TYPEDEFS(Checkable);
- DECLARE_TYPENAME(Checkable);
+ DECLARE_OBJECT(Checkable);
+ DECLARE_OBJECTNAME(Checkable);
Checkable(void);
class I2_ICINGA_API CheckCommand : public ObjectImpl<CheckCommand>
{
public:
- DECLARE_PTR_TYPEDEFS(CheckCommand);
- DECLARE_TYPENAME(CheckCommand);
+ DECLARE_OBJECT(CheckCommand);
+ DECLARE_OBJECTNAME(CheckCommand);
virtual void Execute(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr);
};
class I2_ICINGA_API CheckResult : public ObjectImpl<CheckResult>
{
public:
- DECLARE_PTR_TYPEDEFS(CheckResult);
+ DECLARE_OBJECT(CheckResult);
};
}
class I2_ICINGA_API Command : public ObjectImpl<Command>
{
public:
- DECLARE_PTR_TYPEDEFS(Command);
+ DECLARE_OBJECT(Command);
//virtual Dictionary::Ptr Execute(const Object::Ptr& context) = 0;
class I2_ICINGA_API Comment : public ObjectImpl<Comment>
{
public:
- DECLARE_PTR_TYPEDEFS(Comment);
+ DECLARE_OBJECT(Comment);
bool IsExpired(void) const;
};
class I2_ICINGA_API CustomVarObject : public ObjectImpl<CustomVarObject>
{
public:
- DECLARE_PTR_TYPEDEFS(CustomVarObject);
+ DECLARE_OBJECT(CustomVarObject);
static boost::signals2::signal<void (const CustomVarObject::Ptr&, const Dictionary::Ptr& vars, const MessageOrigin&)> OnVarsChanged;
class I2_ICINGA_API Dependency : public ObjectImpl<Dependency>
{
public:
- DECLARE_PTR_TYPEDEFS(Dependency);
- DECLARE_TYPENAME(Dependency);
+ DECLARE_OBJECT(Dependency);
+ DECLARE_OBJECTNAME(Dependency);
shared_ptr<Checkable> GetParent(void) const;
shared_ptr<Checkable> GetChild(void) const;
class I2_ICINGA_API Downtime : public ObjectImpl<Downtime>
{
public:
- DECLARE_PTR_TYPEDEFS(Downtime);
+ DECLARE_OBJECT(Downtime);
bool IsActive(void) const;
bool IsTriggered(void) const;
class I2_ICINGA_API EventCommand : public ObjectImpl<EventCommand>
{
public:
- DECLARE_PTR_TYPEDEFS(EventCommand);
- DECLARE_TYPENAME(EventCommand);
+ DECLARE_OBJECT(EventCommand);
+ DECLARE_OBJECTNAME(EventCommand);
virtual void Execute(const Checkable::Ptr& checkable);
};
class I2_ICINGA_API Host : public ObjectImpl<Host>, public MacroResolver
{
public:
- DECLARE_PTR_TYPEDEFS(Host);
- DECLARE_TYPENAME(Host);
+ DECLARE_OBJECT(Host);
+ DECLARE_OBJECTNAME(Host);
shared_ptr<Service> GetServiceByShortName(const Value& name);
class I2_ICINGA_API HostGroup : public ObjectImpl<HostGroup>
{
public:
- DECLARE_PTR_TYPEDEFS(HostGroup);
- DECLARE_TYPENAME(HostGroup);
+ DECLARE_OBJECT(HostGroup);
+ DECLARE_OBJECTNAME(HostGroup);
std::set<Host::Ptr> GetMembers(void) const;
void AddMember(const Host::Ptr& host);
class I2_ICINGA_API IcingaApplication : public ObjectImpl<IcingaApplication>, public MacroResolver
{
public:
- DECLARE_PTR_TYPEDEFS(IcingaApplication);
- DECLARE_TYPENAME(IcingaApplication);
+ DECLARE_OBJECT(IcingaApplication);
+ DECLARE_OBJECTNAME(IcingaApplication);
static void StaticInitialize(void);
class IcingaStatusWriter : public ObjectImpl<IcingaStatusWriter>
{
public:
- DECLARE_PTR_TYPEDEFS(IcingaStatusWriter);
- DECLARE_TYPENAME(IcingaStatusWriter);
+ DECLARE_OBJECT(IcingaStatusWriter);
+ DECLARE_OBJECTNAME(IcingaStatusWriter);
static Value StatsFunc(Dictionary::Ptr& status, Array::Ptr& perfdata);
static Dictionary::Ptr GetStatusData(void);
} else if (ref.IsObject()) {
Object::Ptr object = ref;
- const Type *type = object->GetReflectionType();
+ Type::Ptr type = object->GetReflectionType();
if (!type) {
valid = false;
class I2_ICINGA_API MacroResolver
{
public:
- DECLARE_PTR_TYPEDEFS(MacroResolver);
+ DECLARE_OBJECT(MacroResolver);
virtual bool ResolveMacro(const String& macro, const CheckResult::Ptr& cr, String *result) const = 0;
};
class I2_ICINGA_API Notification : public ObjectImpl<Notification>
{
public:
- DECLARE_PTR_TYPEDEFS(Notification);
- DECLARE_TYPENAME(Notification);
+ DECLARE_OBJECT(Notification);
+ DECLARE_OBJECTNAME(Notification);
static void StaticInitialize(void);
class I2_ICINGA_API NotificationCommand : public ObjectImpl<NotificationCommand>
{
public:
- DECLARE_PTR_TYPEDEFS(NotificationCommand);
- DECLARE_TYPENAME(NotificationCommand);
+ DECLARE_OBJECT(NotificationCommand);
+ DECLARE_OBJECTNAME(NotificationCommand);
virtual Dictionary::Ptr Execute(const shared_ptr<Notification>& notification,
const User::Ptr& user, const CheckResult::Ptr& cr, const NotificationType& type,
class I2_ICINGA_API PerfdataValue : public ObjectImpl<PerfdataValue>
{
public:
- DECLARE_PTR_TYPEDEFS(PerfdataValue);
+ DECLARE_OBJECT(PerfdataValue);
PerfdataValue(void);
class I2_ICINGA_API ScheduledDowntime : public ObjectImpl<ScheduledDowntime>
{
public:
- DECLARE_PTR_TYPEDEFS(ScheduledDowntime);
- DECLARE_TYPENAME(ScheduledDowntime);
+ DECLARE_OBJECT(ScheduledDowntime);
+ DECLARE_OBJECTNAME(ScheduledDowntime);
static void StaticInitialize(void);
class I2_ICINGA_API Service : public ObjectImpl<Service>, public MacroResolver
{
public:
- DECLARE_PTR_TYPEDEFS(Service);
- DECLARE_TYPENAME(Service);
+ DECLARE_OBJECT(Service);
+ DECLARE_OBJECTNAME(Service);
static Service::Ptr GetByNamePair(const String& hostName, const String& serviceName);
class I2_ICINGA_API ServiceGroup : public ObjectImpl<ServiceGroup>
{
public:
- DECLARE_PTR_TYPEDEFS(ServiceGroup);
- DECLARE_TYPENAME(ServiceGroup);
+ DECLARE_OBJECT(ServiceGroup);
+ DECLARE_OBJECTNAME(ServiceGroup);
std::set<Service::Ptr> GetMembers(void) const;
void AddMember(const Service::Ptr& service);
class I2_ICINGA_API TimePeriod : public ObjectImpl<TimePeriod>
{
public:
- DECLARE_PTR_TYPEDEFS(TimePeriod);
- DECLARE_TYPENAME(TimePeriod);
+ DECLARE_OBJECT(TimePeriod);
+ DECLARE_OBJECTNAME(TimePeriod);
static void StaticInitialize(void);
class I2_ICINGA_API User : public ObjectImpl<User>
{
public:
- DECLARE_PTR_TYPEDEFS(User);
- DECLARE_TYPENAME(User);
+ DECLARE_OBJECT(User);
+ DECLARE_OBJECTNAME(User);
void AddGroup(const String& name);
class I2_ICINGA_API UserGroup : public ObjectImpl<UserGroup>
{
public:
- DECLARE_PTR_TYPEDEFS(UserGroup);
- DECLARE_TYPENAME(UserGroup);
+ DECLARE_OBJECT(UserGroup);
+ DECLARE_OBJECTNAME(UserGroup);
std::set<User::Ptr> GetMembers(void) const;
void AddMember(const User::Ptr& user);
class Aggregator : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(Aggregator);
+ DECLARE_OBJECT(Aggregator);
virtual void Apply(const Table::Ptr& table, const Value& row) = 0;
virtual double GetResult(void) const = 0;
class AndFilter : public CombinerFilter
{
public:
- DECLARE_PTR_TYPEDEFS(AndFilter);
+ DECLARE_OBJECT(AndFilter);
AndFilter(void);
class AttributeFilter : public Filter
{
public:
- DECLARE_PTR_TYPEDEFS(AttributeFilter);
+ DECLARE_OBJECT(AttributeFilter);
AttributeFilter(const String& column, const String& op, const String& operand);
class AvgAggregator : public Aggregator
{
public:
- DECLARE_PTR_TYPEDEFS(AvgAggregator);
+ DECLARE_OBJECT(AvgAggregator);
AvgAggregator(const String& attr);
class CombinerFilter : public Filter
{
public:
- DECLARE_PTR_TYPEDEFS(CombinerFilter);
+ DECLARE_OBJECT(CombinerFilter);
CombinerFilter(void);
class CommandsTable : public Table
{
public:
- DECLARE_PTR_TYPEDEFS(CommandsTable);
+ DECLARE_OBJECT(CommandsTable);
CommandsTable(void);
class CommentsTable : public Table
{
public:
- DECLARE_PTR_TYPEDEFS(CommentsTable);
+ DECLARE_OBJECT(CommentsTable);
CommentsTable(void);
class ContactGroupsTable : public Table
{
public:
- DECLARE_PTR_TYPEDEFS(ContactGroupsTable);
+ DECLARE_OBJECT(ContactGroupsTable);
ContactGroupsTable(void);
class ContactsTable : public Table
{
public:
- DECLARE_PTR_TYPEDEFS(ContactsTable);
+ DECLARE_OBJECT(ContactsTable);
ContactsTable(void);
class CountAggregator : public Aggregator
{
public:
- DECLARE_PTR_TYPEDEFS(CountAggregator);
+ DECLARE_OBJECT(CountAggregator);
CountAggregator(void);
class DowntimesTable : public Table
{
public:
- DECLARE_PTR_TYPEDEFS(DowntimesTable);
+ DECLARE_OBJECT(DowntimesTable);
DowntimesTable(void);
class EndpointsTable : public Table
{
public:
- DECLARE_PTR_TYPEDEFS(EndpointsTable);
+ DECLARE_OBJECT(EndpointsTable);
EndpointsTable(void);
class Filter : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(Filter);
+ DECLARE_OBJECT(Filter);
virtual bool Apply(const Table::Ptr& table, const Value& row) = 0;
class HostGroupsTable : public Table
{
public:
- DECLARE_PTR_TYPEDEFS(HostGroupsTable);
+ DECLARE_OBJECT(HostGroupsTable);
HostGroupsTable(void);
class HostsTable : public Table
{
public:
- DECLARE_PTR_TYPEDEFS(HostsTable);
+ DECLARE_OBJECT(HostsTable);
HostsTable(void);
class InvAvgAggregator : public Aggregator
{
public:
- DECLARE_PTR_TYPEDEFS(InvAvgAggregator);
+ DECLARE_OBJECT(InvAvgAggregator);
InvAvgAggregator(const String& attr);
class InvSumAggregator : public Aggregator
{
public:
- DECLARE_PTR_TYPEDEFS(InvSumAggregator);
+ DECLARE_OBJECT(InvSumAggregator);
InvSumAggregator(const String& attr);
class LivestatusListener : public ObjectImpl<LivestatusListener>
{
public:
- DECLARE_PTR_TYPEDEFS(LivestatusListener);
- DECLARE_TYPENAME(LivestatusListener);
+ DECLARE_OBJECT(LivestatusListener);
+ DECLARE_OBJECTNAME(LivestatusListener);
static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
class LivestatusQuery : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(LivestatusQuery);
+ DECLARE_OBJECT(LivestatusQuery);
LivestatusQuery(const std::vector<String>& lines, const String& compat_log_path);
class LogTable : public HistoryTable
{
public:
- DECLARE_PTR_TYPEDEFS(LogTable);
+ DECLARE_OBJECT(LogTable);
LogTable(const String& compat_log_path, time_t from, time_t until);
class MaxAggregator : public Aggregator
{
public:
- DECLARE_PTR_TYPEDEFS(MaxAggregator);
+ DECLARE_OBJECT(MaxAggregator);
MaxAggregator(const String& attr);
class MinAggregator : public Aggregator
{
public:
- DECLARE_PTR_TYPEDEFS(MinAggregator);
+ DECLARE_OBJECT(MinAggregator);
MinAggregator(const String& attr);
class NegateFilter : public Filter
{
public:
- DECLARE_PTR_TYPEDEFS(NegateFilter);
+ DECLARE_OBJECT(NegateFilter);
NegateFilter(const Filter::Ptr& inner);
class OrFilter : public CombinerFilter
{
public:
- DECLARE_PTR_TYPEDEFS(OrFilter);
+ DECLARE_OBJECT(OrFilter);
OrFilter(void);
class ServiceGroupsTable : public Table
{
public:
- DECLARE_PTR_TYPEDEFS(ServiceGroupsTable);
+ DECLARE_OBJECT(ServiceGroupsTable);
ServiceGroupsTable(void);
class ServicesTable : public Table
{
public:
- DECLARE_PTR_TYPEDEFS(ServicesTable);
+ DECLARE_OBJECT(ServicesTable);
ServicesTable(void);
class StateHistTable : public HistoryTable
{
public:
- DECLARE_PTR_TYPEDEFS(StateHistTable);
+ DECLARE_OBJECT(StateHistTable);
StateHistTable(const String& compat_log_path, time_t from, time_t until);
class StatusTable : public Table
{
public:
- DECLARE_PTR_TYPEDEFS(StatusTable);
+ DECLARE_OBJECT(StatusTable);
StatusTable(void);
class StdAggregator : public Aggregator
{
public:
- DECLARE_PTR_TYPEDEFS(StdAggregator);
+ DECLARE_OBJECT(StdAggregator);
StdAggregator(const String& attr);
class SumAggregator : public Aggregator
{
public:
- DECLARE_PTR_TYPEDEFS(SumAggregator);
+ DECLARE_OBJECT(SumAggregator);
SumAggregator(const String& attr);
class Table : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(Table);
+ DECLARE_OBJECT(Table);
static Table::Ptr GetByName(const String& name, const String& compat_log_path = "", const unsigned long& from = 0, const unsigned long& until = 0);
class TimePeriodsTable : public Table
{
public:
- DECLARE_PTR_TYPEDEFS(TimePeriodsTable);
+ DECLARE_OBJECT(TimePeriodsTable);
TimePeriodsTable(void);
class NotificationComponent : public ObjectImpl<NotificationComponent>
{
public:
- DECLARE_PTR_TYPEDEFS(NotificationComponent);
- DECLARE_TYPENAME(NotificationComponent);
+ DECLARE_OBJECT(NotificationComponent);
+ DECLARE_OBJECTNAME(NotificationComponent);
static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
class GraphiteWriter : public ObjectImpl<GraphiteWriter>
{
public:
- DECLARE_PTR_TYPEDEFS(GraphiteWriter);
- DECLARE_TYPENAME(GraphiteWriter);
+ DECLARE_OBJECT(GraphiteWriter);
+ DECLARE_OBJECTNAME(GraphiteWriter);
static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
class PerfdataWriter : public ObjectImpl<PerfdataWriter>
{
public:
- DECLARE_PTR_TYPEDEFS(PerfdataWriter);
- DECLARE_TYPENAME(PerfdataWriter);
+ DECLARE_OBJECT(PerfdataWriter);
+ DECLARE_OBJECTNAME(PerfdataWriter);
static Value StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
class I2_REMOTE_API ApiClient : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(ApiClient);
+ DECLARE_OBJECT(ApiClient);
ApiClient(const String& identity, bool authenticated, const TlsStream::Ptr& stream, ConnectionRole role);
class I2_REMOTE_API ApiFunction : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(ApiFunction);
+ DECLARE_OBJECT(ApiFunction);
typedef boost::function<Value(const MessageOrigin& origin, const Dictionary::Ptr&)> Callback;
class I2_REMOTE_API ApiListener : public ObjectImpl<ApiListener>
{
public:
- DECLARE_PTR_TYPEDEFS(ApiListener);
- DECLARE_TYPENAME(ApiListener);
+ DECLARE_OBJECT(ApiListener);
+ DECLARE_OBJECTNAME(ApiListener);
static boost::signals2::signal<void(bool)> OnMasterChanged;
class I2_REMOTE_API Endpoint : public ObjectImpl<Endpoint>
{
public:
- DECLARE_PTR_TYPEDEFS(Endpoint);
- DECLARE_TYPENAME(Endpoint);
+ DECLARE_OBJECT(Endpoint);
+ DECLARE_OBJECTNAME(Endpoint);
static boost::signals2::signal<void(const Endpoint::Ptr&, const shared_ptr<ApiClient>&)> OnConnected;
static boost::signals2::signal<void(const Endpoint::Ptr&, const shared_ptr<ApiClient>&)> OnDisconnected;
class I2_REMOTE_API Zone : public ObjectImpl<Zone>
{
public:
- DECLARE_PTR_TYPEDEFS(Zone);
- DECLARE_TYPENAME(Zone);
+ DECLARE_OBJECT(Zone);
+ DECLARE_OBJECTNAME(Zone);
Zone::Ptr GetParent(void) const;
std::set<Endpoint::Ptr> GetEndpoints(void) const;
class TestObject : public Object
{
public:
- DECLARE_PTR_TYPEDEFS(TestObject);
+ DECLARE_OBJECT(TestObject);
TestObject::Ptr GetTestRef(void)
{
BOOST_AUTO_TEST_CASE(gettype)
{
- const Type *t = Type::GetByName("Application");
+ Type::Ptr t = Type::GetByName("Application");
BOOST_CHECK(t);
}
BOOST_AUTO_TEST_CASE(assign)
{
- const Type *t1 = Type::GetByName("Application");
- const Type *t2 = Type::GetByName("DynamicObject");
+ Type::Ptr t1 = Type::GetByName("Application");
+ Type::Ptr t2 = Type::GetByName("DynamicObject");
BOOST_CHECK(t1->IsAssignableFrom(t1));
BOOST_CHECK(t2->IsAssignableFrom(t1));
BOOST_AUTO_TEST_CASE(byname)
{
- const Type *t = Type::GetByName("Application");
+ Type::Ptr t = Type::GetByName("Application");
BOOST_CHECK(t);
}
BOOST_AUTO_TEST_CASE(instantiate)
{
- const Type *t = Type::GetByName("PerfdataValue");
+ Type::Ptr t = Type::GetByName("PerfdataValue");
Object::Ptr p = t->Instantiate();
<< "\t" << "}" << std::endl << std::endl;
/* GetBaseType */
- std::cout << "\t" << "virtual const Type *GetBaseType(void) const" << std::endl
+ std::cout << "\t" << "virtual Type::Ptr GetBaseType(void) const" << std::endl
<< "\t" << "{" << std::endl;
std::cout << "\t\t" << "return ";
if (!klass.Parent.empty())
std::cout << "Type::GetByName(\"" << klass.Parent << "\")";
else
- std::cout << "NULL";
+ std::cout << "Type::Ptr()";
std::cout << ";" << std::endl
<< "\t" << "}" << std::endl << std::endl;
<< " : public " << (klass.Parent.empty() ? "Object" : klass.Parent) << std::endl
<< "{" << std::endl
<< "public:" << std::endl
- << "\t" << "DECLARE_PTR_TYPEDEFS(ObjectImpl<" << klass.Name << ">);" << std::endl << std::endl;
-
- /* GetReflectionType */
- std::cout << "\t" << "virtual const Type *GetReflectionType(void) const" << std::endl
- << "\t" << "{" << std::endl
- << "\t\t" << "return Type::GetByName(\"" << klass.Name << "\");" << std::endl
- << "\t" << "}" << std::endl << std::endl;
+ << "\t" << "DECLARE_PTR_TYPEDEFS(ObjectImpl<" << klass.Name << ">);" << std::endl
+ << "\t" << "IMPL_TYPE_LOOKUP(" << klass.Name << ");" << std::endl << std::endl;
if (!klass.Fields.empty()) {
/* constructor */