ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthToolSupport
AsgTools
Root
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
"
10
#include "
AsgMessaging/StatusCode.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
21
const
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
43
Property::Property
()
44
:
m_type
(
UNKNOWNTYPE
) {
45
46
}
47
48
Property::Property
(
Type
type
)
49
:
m_type
(
type
) {
50
51
}
52
53
bool
Property::isValid
()
const
{
54
55
return
(
m_type
!=
UNKNOWNTYPE
);
56
}
57
58
Property::Type
Property::type
()
const
{
59
60
return
m_type
;
61
}
62
63
const
std::string&
Property::typeName
()
const
{
64
65
return
name
(
m_type
);
66
}
67
68
int
Property::setFrom
(
const
Property
& ) {
69
70
std::cout <<
"Property::setFrom: Property not set!"
<< std::endl;
71
return
-1;
72
}
73
74
75
76
StatusCode
Property::getString
(std::string&
/*result*/
)
const
{
77
std::cout <<
"Property::getString: method not implemented"
<< std::endl;
78
return
StatusCode::FAILURE;
79
}
80
81
StatusCode
Property::getCastString
(std::string&
/*result*/
)
const
{
82
std::cout <<
"Property::getCastString: method not implemented"
<< std::endl;
83
return
StatusCode::FAILURE;
84
}
85
86
StatusCode
Property::setString
(
const
std::string&
/*value*/
) {
87
std::cout <<
"Property::setString: method not implemented"
<< std::endl;
88
return
StatusCode::FAILURE;
89
}
StatusCode.h
DECLARE_TYPE
#define DECLARE_TYPE(TYPE, NAME)
Macro used in implementing the type->name translation function.
Definition
Property.cxx:13
Property.h
Property::name
static const std::string & name(Type type)
Function returning a user-readable name for a property type.
Definition
Property.cxx:21
Property::type
Type type() const
Return the type index.
Definition
Property.cxx:58
Property::isValid
bool isValid() const
Return if this is a valid property.
Definition
Property.cxx:53
Property::getString
virtual StatusCode getString(std::string &result) const
get the property as a string
Definition
Property.cxx:76
Property::m_type
Type m_type
The type of the property.
Definition
Property.h:106
Property::typeName
const std::string & typeName() const
Return the type name.
Definition
Property.cxx:63
Property::setFrom
virtual int setFrom(const Property &rhs)
Definition
Property.cxx:68
Property::Type
Type
Property type enumeration.
Definition
Property.h:27
Property::FLOATVECTOR
@ FLOATVECTOR
Definition
Property.h:35
Property::INTVECTOR
@ INTVECTOR
Definition
Property.h:34
Property::DOUBLE
@ DOUBLE
Definition
Property.h:32
Property::TOOLHANDLEARRAY
@ TOOLHANDLEARRAY
Definition
Property.h:38
Property::UNKNOWNTYPE
@ UNKNOWNTYPE
Definition
Property.h:28
Property::STRING
@ STRING
Definition
Property.h:33
Property::FLOAT
@ FLOAT
Definition
Property.h:31
Property::TOOLHANDLE
@ TOOLHANDLE
Definition
Property.h:37
Property::STRINGVECTOR
@ STRINGVECTOR
Definition
Property.h:36
Property::INT
@ INT
Definition
Property.h:30
Property::BOOL
@ BOOL
Definition
Property.h:29
Property::setString
virtual StatusCode setString(const std::string &value)
set the property from a string
Definition
Property.cxx:86
Property::Property
Property()
Default constructor.
Definition
Property.cxx:43
Property::getCastString
virtual StatusCode getCastString(std::string &result) const
get the property as a string I can pas to setString
Definition
Property.cxx:81
Generated on
for ATLAS Offline Software by
1.17.0