Otawa  0.10
info.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  * Identifier information
4  *
5  * This file is part of OTAWA
6  * Copyright (c) 2009, IRIT UPS.
7  *
8  * OTAWA is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * OTAWA is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with OTAWA; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 #ifndef OTAWA_PROP_INFO_H_
23 #define OTAWA_PROP_INFO_H_
24 
25 #include <otawa/prop/Identifier.h>
26 
27 namespace otawa {
28 
29 // property maker
30 template <class T>
31 inline Property *make(const Identifier<T>& id, const T& v) {
32  return new GenericProperty<T>(id, v);
33 }
34 
35 // string adaptaters
36 inline Property *make(const Identifier<cstring>& id, const char *v)
37  { return make(id, cstring(v)); }
38 inline Property *make(const Identifier<string>& id, const char *v)
39  { return make(id, string(v)); }
40 
41 
42 // identifiers
43 extern Identifier<cstring> IDENTIFIER_LABEL;
44 extern Identifier<cstring> IDENTIFIER_DESC;
45 inline Property *idLabel(cstring label) { return make(IDENTIFIER_LABEL, label); }
46 inline Property *idDesc(cstring desc) { return make(IDENTIFIER_DESC, desc); }
47 
48 } // otawa
49 
50 #endif /* OTAWA_PROP_INFO_H_ */
Property * idLabel(cstring label)
Definition: info.h:45
This generic class allows attaching any type of data to a property.
Definition: Property.h:20
Property * idDesc(cstring desc)
Definition: info.h:46
Identifier< cstring > IDENTIFIER_DESC
Property of this identifier is put on identifier to give a more precise description of the identifier...
Property * make(const Identifier< T > &id, const T &v)
Definition: info.h:31
This class represents identifier with a typed associated value.
Definition: Identifier.h:51
A property associates a data with an identifier.
Definition: PropList.h:42
Identifier< cstring > IDENTIFIER_LABEL
Property of this identifier is put on identifier to give a more human-readable name to the identifier...