ATLAS Offline Software
Loading...
Searching...
No Matches
Property.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5// System include(s):
6#include <iostream>
7
8// Local include(s):
9#include "AsgTools/Property.h"
11
13#define DECLARE_TYPE( TYPE, NAME ) \
14 case TYPE: \
15 { \
16 static const std::string n( NAME ); \
17 return n; \
18 } \
19 break
20
21const std::string& Property::name( Type type ) {
22
23 switch( type ) {
24 DECLARE_TYPE( UNKNOWNTYPE, "unknown" );
25 DECLARE_TYPE( BOOL, "bool" );
26 DECLARE_TYPE( INT, "int" );
27 DECLARE_TYPE( FLOAT, "float" );
28 DECLARE_TYPE( DOUBLE, "double" );
29 DECLARE_TYPE( STRING, "string" );
30 DECLARE_TYPE( INTVECTOR, "vector<int>" );
31 DECLARE_TYPE( FLOATVECTOR, "vector<float>" );
32 DECLARE_TYPE( STRINGVECTOR, "vector<string>" );
33 DECLARE_TYPE( TOOLHANDLE, "ToolHandle" );
34 DECLARE_TYPE( TOOLHANDLEARRAY, "ToolHandleArray" );
35 default:
36 break;
37 }
38
39 static const std::string dummy( "<error>" );
40 return dummy;
41}
42
47
52
53bool Property::isValid() const {
54
55 return ( m_type != UNKNOWNTYPE );
56}
57
59
60 return m_type;
61}
62
63const std::string& Property::typeName() const {
64
65 return name( m_type );
66}
67
69
70 std::cout << "Property::setFrom: Property not set!" << std::endl;
71 return -1;
72}
73
74
75
76StatusCode Property::getString (std::string& /*result*/) const {
77 std::cout << "Property::getString: method not implemented" << std::endl;
78 return StatusCode::FAILURE;
79}
80
81StatusCode Property::getCastString (std::string& /*result*/) const {
82 std::cout << "Property::getCastString: method not implemented" << std::endl;
83 return StatusCode::FAILURE;
84}
85
86StatusCode Property::setString (const std::string& /*value*/) {
87 std::cout << "Property::setString: method not implemented" << std::endl;
88 return StatusCode::FAILURE;
89}
#define DECLARE_TYPE(TYPE, NAME)
Macro used in implementing the type->name translation function.
Definition Property.cxx:13
static const std::string & name(Type type)
Function returning a user-readable name for a property type.
Definition Property.cxx:21
Type type() const
Return the type index.
Definition Property.cxx:58
bool isValid() const
Return if this is a valid property.
Definition Property.cxx:53
virtual StatusCode getString(std::string &result) const
get the property as a string
Definition Property.cxx:76
Type m_type
The type of the property.
Definition Property.h:106
const std::string & typeName() const
Return the type name.
Definition Property.cxx:63
virtual int setFrom(const Property &rhs)
Definition Property.cxx:68
Type
Property type enumeration.
Definition Property.h:27
@ FLOATVECTOR
Definition Property.h:35
@ INTVECTOR
Definition Property.h:34
@ TOOLHANDLEARRAY
Definition Property.h:38
@ UNKNOWNTYPE
Definition Property.h:28
@ TOOLHANDLE
Definition Property.h:37
@ STRINGVECTOR
Definition Property.h:36
virtual StatusCode setString(const std::string &value)
set the property from a string
Definition Property.cxx:86
Property()
Default constructor.
Definition Property.cxx:43
virtual StatusCode getCastString(std::string &result) const
get the property as a string I can pas to setString
Definition Property.cxx:81