DynamicType::Ptr DynamicObject::GetType(void) const
{
- return DynamicType::GetByName(GetTypeName());
+ return DynamicType::GetByName(GetTypeNameV());
}
DebugInfo DynamicObject::GetDebugInfo(void) const
return m_ShortName;
}}}
};
- [config, internal, get_protected] String type (TypeName);
- [config] String zone;
+ [config, internal, get_protected] String type (TypeNameV);
+ [config] String zone (ZoneName);
[config, internal, get_protected] Array::Ptr templates;
[get_protected] bool active;
[get_protected] bool paused {
Checkable::Ptr checkable = static_pointer_cast<Checkable>(object);
- Zone::Ptr zone = Zone::GetByName(checkable->GetZone());
+ Zone::Ptr zone = Zone::GetByName(checkable->GetZoneName());
bool same_zone = (!zone || Zone::GetLocalZone() == zone);
{
DynamicObject::Ptr dobj = static_pointer_cast<DynamicObject>(type->Instantiate());
dobj->SetDebugInfo(m_DebugInfo);
- dobj->SetTypeName(m_Type);
- dobj->SetZone(m_Zone);
+ dobj->SetTypeNameV(m_Type);
+ dobj->SetZoneName(m_Zone);
dobj->SetName(m_Name);
DebugHint debugHints;
if (service)
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "child_service_name"), OpSetLiteral, MakeLiteral(service->GetShortName()), di));
- String zone = checkable->GetZone();
+ String zone = checkable->GetZoneName();
if (!zone.IsEmpty())
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "zone"), OpSetLiteral, MakeLiteral(zone), di));
static HostState CalculateState(ServiceState state);
- HostState GetState(void) const;
- HostState GetLastState(void) const;
- HostState GetLastHardState(void) const;
+ virtual HostState GetState(void) const;
+ virtual HostState GetLastState(void) const;
+ virtual HostState GetLastHardState(void) const;
double GetLastStateUp(void) const;
double GetLastStateDown(void) const;
[config] String address;
[config] String address6;
+
+ [enum, no_storage] HostState "state" {
+ get;
+ };
+ [enum, no_storage] HostState last_state {
+ get;
+ };
+ [enum, no_storage] HostState last_hard_state {
+ get;
+ };
+
};
}
if (service)
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "service_name"), OpSetLiteral, MakeLiteral(service->GetShortName()), di));
- String zone = checkable->GetZone();
+ String zone = checkable->GetZoneName();
if (!zone.IsEmpty())
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "zone"), OpSetLiteral, MakeLiteral(zone), di));
if (service)
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "service_name"), OpSetLiteral, MakeLiteral(service->GetShortName()), di));
- String zone = checkable->GetZone();
+ String zone = checkable->GetZoneName();
if (!zone.IsEmpty())
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "zone"), OpSetLiteral, MakeLiteral(zone), di));
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "name"), OpSetLiteral, MakeLiteral(name), di));
- String zone = host->GetZone();
+ String zone = host->GetZoneName();
if (!zone.IsEmpty())
builder->AddExpression(new SetExpression(MakeIndexer(ScopeCurrent, "zone"), OpSetLiteral, MakeLiteral(zone), di));
}}}
};
[config] String host_name;
- [enum] ServiceState "state" {
+ [enum, no_storage] ServiceState "state" {
get {{{
return GetStateRaw();
}}}
};
- [enum] ServiceState last_state {
+ [enum, no_storage] ServiceState last_state {
get {{{
return GetLastStateRaw();
}}}
};
- [enum] ServiceState last_hard_state {
+ [enum, no_storage] ServiceState last_hard_state {
get {{{
return GetLastHardStateRaw();
}}}
/* only relay the message to a) the same zone, b) the parent zone and c) direct child zones */
if (target_zone != my_zone && target_zone != my_zone->GetParent() &&
- secobj->GetZone() != target_zone->GetName()) {
+ secobj->GetZoneName() != target_zone->GetName()) {
skippedEndpoints.push_back(endpoint);
continue;
}
if (dynamic_pointer_cast<Zone>(object))
object_zone = static_pointer_cast<Zone>(object);
else
- object_zone = Zone::GetByName(object->GetZone());
+ object_zone = Zone::GetByName(object->GetZoneName());
if (!object_zone)
object_zone = Zone::GetLocalZone();
set_protected { yylval->num = FASetProtected; return T_FIELD_ATTRIBUTE; }
protected { yylval->num = FAGetProtected | FASetProtected; return T_FIELD_ATTRIBUTE; }
internal { yylval->num = FAInternal; return T_FIELD_ATTRIBUTE; }
+no_storage { yylval->num = FANoStorage; return T_FIELD_ATTRIBUTE; }
default { yylval->num = FTDefault; return T_FIELD_ACCESSOR_TYPE; }
get { yylval->num = FTGet; return T_FIELD_ACCESSOR_TYPE; }
set { yylval->num = FTSet; return T_FIELD_ACCESSOR_TYPE; }
switch (it->Type) {
case FTGet:
field->GetAccessor = it->Accessor;
+ field->PureGetAccessor = it->Pure;
break;
case FTSet:
field->SetAccessor = it->Accessor;
+ field->PureSetAccessor = it->Pure;
break;
case FTDefault:
field->DefaultAccessor = it->Accessor;
field_accessor: T_FIELD_ACCESSOR_TYPE T_STRING
{
- $$ = new FieldAccessor(static_cast<FieldAccessorType>($1), $2);
+ $$ = new FieldAccessor(static_cast<FieldAccessorType>($1), $2, false);
std::free($2);
}
+ | T_FIELD_ACCESSOR_TYPE ';'
+ {
+ $$ = new FieldAccessor(static_cast<FieldAccessorType>($1), "", true);
+ }
;
identifier: T_IDENTIFIER
prot = "public";
std::cout << prot << ":" << std::endl
- << "\t" << it->Type << " Get" << it->GetFriendlyName() << "(void) const" << std::endl
+ << "\t" << "virtual " << it->Type << " Get" << it->GetFriendlyName() << "(void) const";
+
+ if (it->PureGetAccessor) {
+ std::cout << " = 0;" << std::endl;
+ } else {
+ std::cout << std::endl
<< "\t" << "{" << std::endl;
- if (it->GetAccessor.empty())
- std::cout << "\t\t" << "return m_" << it->GetFriendlyName() << ";" << std::endl;
- else
- std::cout << it->GetAccessor << std::endl;
+ if (it->GetAccessor.empty() && !(it->Attributes & FANoStorage))
+ std::cout << "\t\t" << "return m_" << it->GetFriendlyName() << ";" << std::endl;
+ else
+ std::cout << it->GetAccessor << std::endl;
- std::cout << "\t" << "}" << std::endl << std::endl;
+ std::cout << "\t" << "}" << std::endl << std::endl;
+ }
}
/* setters */
else
std::cout << "const " << it->Type << "&";
- std::cout << " value)" << std::endl
- << "\t" << "{" << std::endl;
+ std::cout << " value)" << std::endl;
- if (it->SetAccessor.empty())
- std::cout << "\t\t" << "m_" << it->GetFriendlyName() << " = value;" << std::endl;
- else
- std::cout << it->SetAccessor << std::endl;
+ if (it->PureSetAccessor) {
+ std::cout << " = 0;" << std::endl;
+ } else {
+ std::cout << "\t" << "{" << std::endl;
+
+ if (it->SetAccessor.empty() && !(it->Attributes & FANoStorage))
+ std::cout << "\t\t" << "m_" << it->GetFriendlyName() << " = value;" << std::endl;
+ else
+ std::cout << it->SetAccessor << std::endl;
- std::cout << "\t" << "}" << std::endl << std::endl;
+ std::cout << "\t" << "}" << std::endl << std::endl;
+ }
}
/* default */
{
FieldAccessorType Type;
std::string Accessor;
+ bool Pure;
- FieldAccessor(FieldAccessorType type, const std::string& accessor)
- : Type(type), Accessor(accessor)
+ FieldAccessor(FieldAccessorType type, const std::string& accessor, bool pure)
+ : Type(type), Accessor(accessor), Pure(pure)
{ }
};
FAEnum = 4,
FAGetProtected = 8,
FASetProtected = 16,
- FAInternal = 32
+ FAInternal = 32,
+ FANoStorage = 64
};
struct Field
std::string Name;
std::string AlternativeName;
std::string GetAccessor;
+ bool PureGetAccessor;
std::string SetAccessor;
+ bool PureSetAccessor;
std::string DefaultAccessor;
std::string GetFriendlyName(void) const