1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
3 #include "base/objecttype.hpp"
4 #include "base/initialize.hpp"
5 #include <boost/throw_exception.hpp>
7 using namespace icinga;
9 /* Ensure that the priority is lower than the basic namespace initialization in scriptframe.cpp. */
10 INITIALIZE_ONCE_WITH_PRIORITY([]() {
11 Type::Ptr type = new ObjectType();
12 type->SetPrototype(Object::GetPrototype());
14 Object::TypeInstance = type;
17 String ObjectType::GetName() const
22 Type::Ptr ObjectType::GetBaseType() const
27 int ObjectType::GetAttributes() const
32 int ObjectType::GetFieldId(const String& name) const
40 Field ObjectType::GetFieldInfo(int id) const
43 return {1, "String", "type", nullptr, nullptr, 0, 0};
45 BOOST_THROW_EXCEPTION(std::runtime_error("Invalid field ID."));
48 int ObjectType::GetFieldCount() const
53 ObjectFactory ObjectType::GetFactory() const
55 return DefaultObjectFactory<Object>;