# Coriolis Core (CRL) Documentation

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

Environment.h
1 // -*- C++ -*-
2 //
3 // This file is part of the Coriolis Software.
4 // Copyright (c) UPMC 2008-2018, All Rights Reserved
5 //
6 // +-----------------------------------------------------------------+
7 // | C O R I O L I S |
8 // | Alliance / Hurricane Interface |
9 // | |
10 // | Author : Jean-Paul CHAPUT |
11 // | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
12 // | =============================================================== |
13 // | C++ Header : "./crlcore/Environment.h" |
14 // +-----------------------------------------------------------------+
15
16
17 #ifndef CRL_ENVIRONMENT_H
18 #define CRL_ENVIRONMENT_H
19
20 #include <regex.h>
21 #include <string>
22 #include "hurricane/Commons.h"
23 #include "crlcore/SearchPath.h"
24
25
26 namespace CRL {
27
28 using Hurricane::JsonObject;
29 using Hurricane::JsonStack;
30
31
32 // -------------------------------------------------------------------
33 // Class : "Environment".
34
35 class Environment {
36 public:
37 enum AddMode { Append=1, Prepend=2, Replace=3 };
38 public:
39 // Internal: Static Methods.
40 static const char* getEnv ( const char* variable, const char* defaultValue );
41 // Constructors & destructors.
42 Environment ();
43 ~Environment ();
44 // Accessors.
45 inline const std::string& getCORIOLIS_TOP () const;
46 inline const std::string& getDisplayStyle () const;
47 inline long getSCALE_X () const;
48 inline const std::string& getDISPLAY () const;
49 inline const std::string& getIN_LO () const;
50 inline const std::string& getIN_PH () const;
51 inline const std::string& getOUT_LO () const;
52 inline const std::string& getOUT_PH () const;
53 inline const std::string& getPOWER () const;
54 inline const std::string& getGROUND () const;
55 inline const std::string& getCLOCK () const;
56 inline const std::string& getBLOCKAGE () const;
57 inline const std::string& getPad () const;
58 inline const std::string& getCATALOG () const;
59 inline SearchPath& getLIBRARIES ();
60 std::string getLIBRARYPath ( size_t i );
61 // Predicates.
62 bool isPOWER ( const char* name ) const;
63 bool isGROUND ( const char* name ) const;
64 bool isCLOCK ( const char* name ) const;
65 bool isBLOCKAGE ( const char* name ) const;
66 bool isPad ( const char* name ) const;
67 // Modifiers.
68 void validate () const;
69 inline void setDisplayStyle ( const char* );
70 inline void setSCALE_X ( long value );
71 inline void setDISPLAY ( const char* value );
72 inline void setIN_LO ( const char* value );
73 inline void setIN_PH ( const char* value );
74 inline void setOUT_LO ( const char* value );
75 inline void setOUT_PH ( const char* value );
76 void setPOWER ( const char* value );
77 void setGROUND ( const char* value );
78 void setCLOCK ( const char* value );
79 void setBLOCKAGE ( const char* value );
80 void setPad ( const char* value );
81 inline void setCATALOG ( const char* value );
82 void setWORKING_LIBRARY ( const char* value );
83 void addSYSTEM_LIBRARY ( const char* value, const char* libName, unsigned int mode=Append );
84 // Methods.
85 std::string getPrint () const;
86 void toJson ( JsonWriter* ) const;
87 inline std::string _getTypeName () const;
88 std::string _getString () const;
89 Record* _getRecord () const;
90 protected:
91 // Internal: Attributes.
92 std::string _CORIOLIS_TOP;
93 std::string _displayStyle;
94 long _SCALE_X;
95 std::string _DISPLAY;
96 std::string _IN_LO;
97 std::string _IN_PH;
98 std::string _OUT_LO;
99 std::string _OUT_PH;
100 std::string _POWER;
101 std::string _GROUND;
102 std::string _CLOCK;
103 std::string _BLOCKAGE;
104 std::string _pad;
105 std::string _CATALOG;
106 SearchPath _LIBRARIES;
107 regex_t _PowerRegex;
108 regex_t _GroundRegex;
109 regex_t _ClockRegex;
110 regex_t _BlockageRegex;
111 regex_t _padRegex;
112 bool _inConstructor;
113 private:
114 void _setRegex ( regex_t* regex, const std::string& pattern, const char* name );
115 };
116
117
118 // Inline Member Functions.
119 inline const std::string& Environment::getCORIOLIS_TOP () const { return _CORIOLIS_TOP; }
120 inline const std::string& Environment::getDisplayStyle () const { return _displayStyle; }
121 inline long Environment::getSCALE_X () const { return _SCALE_X; }
122 inline const std::string& Environment::getIN_LO () const { return _IN_LO; }
123 inline const std::string& Environment::getIN_PH () const { return _IN_PH; }
124 inline const std::string& Environment::getOUT_LO () const { return _OUT_LO; }
125 inline const std::string& Environment::getOUT_PH () const { return _OUT_PH; }
126 inline const std::string& Environment::getPOWER () const { return _POWER; }
127 inline const std::string& Environment::getGROUND () const { return _GROUND; }
128 inline const std::string& Environment::getCLOCK () const { return _CLOCK; }
129 inline const std::string& Environment::getBLOCKAGE () const { return _BLOCKAGE; }
130 inline const std::string& Environment::getPad () const { return _pad; }
131 inline const std::string& Environment::getCATALOG () const { return _CATALOG; }
132 inline SearchPath& Environment::getLIBRARIES () { return _LIBRARIES; }
133
134 inline void Environment::setDisplayStyle ( const char* value ) { _displayStyle = value; }
135 inline void Environment::setSCALE_X ( long value ) { _SCALE_X = value; }
136 inline void Environment::setIN_LO ( const char* value ) { _IN_LO = value; }
137 inline void Environment::setIN_PH ( const char* value ) { _IN_PH = value; }
138 inline void Environment::setOUT_LO ( const char* value ) { _OUT_LO = value; }
139 inline void Environment::setOUT_PH ( const char* value ) { _OUT_PH = value; }
140 inline void Environment::setCATALOG ( const char* value ) { _CATALOG = value; }
141 inline std::string Environment::_getTypeName () const { return "Environment"; }
142
143
144 // -------------------------------------------------------------------
145 // Class : "JsonEnvironment".
146
147 class JsonEnvironment : public JsonObject {
148 public:
149 static void initialize ();
150 JsonEnvironment ( unsigned long flags );
151 virtual std::string getTypeName () const;
152 virtual JsonEnvironment* clone ( unsigned long flags ) const;
153 virtual void toData ( JsonStack& );
154 };
155
156
157 } // CRL namespace.
158
159
160 INSPECTOR_P_SUPPORT(CRL::Environment);
161
162
163 #endif // CRL_ENVIRONMENT_H
CRL::Environment::setCATALOG
void setCATALOG(const char *value)
Definition: Environment.h:140
CRL::Environment::Append
Definition: Environment.h:37
CRL::Environment::setSCALE_X
void setSCALE_X(long value)
Definition: Environment.h:135
CRL::Environment::getSCALE_X
long getSCALE_X() const
Definition: Environment.h:121
CRL::Environment::setBLOCKAGE
void setBLOCKAGE(const char *value)
CRL::Environment::isPOWER
bool isPOWER(const char *name) const
CRL::Environment::getCLOCK
const std::string & getCLOCK() const
Definition: Environment.h:128
CRL::Environment::getLIBRARIES
SearchPath & getLIBRARIES()
Definition: Environment.h:132
CRL::Environment::setGROUND
void setGROUND(const char *value)
CRL::Environment::getPrint
std::string getPrint() const
CRL::Environment::setWORKING_LIBRARY
void setWORKING_LIBRARY(const char *value)
CRL::Environment::getDisplayStyle
const std::string & getDisplayStyle() const
Definition: Environment.h:120
Hurricane::JsonObject
CRL::Environment::getCORIOLIS_TOP
const std::string & getCORIOLIS_TOP() const
Definition: Environment.h:119
CRL::Environment::Prepend
Definition: Environment.h:37
CRL::Environment::isBLOCKAGE
bool isBLOCKAGE(const char *name) const
CRL::Environment::getOUT_PH
const std::string & getOUT_PH() const
Definition: Environment.h:125
CRL::Environment::getPOWER
const std::string & getPOWER() const
Definition: Environment.h:126
CRL::Environment::Replace
Definition: Environment.h:37
CRL::Environment::setPad
void setPad(const char *value)
CRL::Environment::getGROUND
const std::string & getGROUND() const
Definition: Environment.h:127
CRL::Environment::addSYSTEM_LIBRARY
void addSYSTEM_LIBRARY(const char *value, const char *libName, unsigned int mode=Append)
CRL::Environment::validate
void validate() const
CRL::Environment::setOUT_LO
void setOUT_LO(const char *value)
Definition: Environment.h:138
CRL::Environment::setPOWER
void setPOWER(const char *value)
CRL::Environment::setIN_PH
void setIN_PH(const char *value)
Definition: Environment.h:137
CRL::Environment::isCLOCK
bool isCLOCK(const char *name) const
Hurricane::JsonStack
CRL::Environment::isGROUND
bool isGROUND(const char *name) const
CRL::Environment::getPad
const std::string & getPad() const
Definition: Environment.h:130
CRL::Environment::getDISPLAY
const std::string & getDISPLAY() const
CRL::Environment::Environment
Environment()
CRL::Environment::~Environment
~Environment()
CRL::Environment::setIN_LO
void setIN_LO(const char *value)
Definition: Environment.h:136
CRL::Environment::isPad
bool isPad(const char *name) const
CRL::SearchPath
An ordered list of search pathes.
Definition: SearchPath.h:32
CRL::Environment::getIN_LO
const std::string & getIN_LO() const
Definition: Environment.h:122
CRL::Environment::getOUT_LO
const std::string & getOUT_LO() const
Definition: Environment.h:124
CRL::Environment::setOUT_PH
void setOUT_PH(const char *value)
Definition: Environment.h:139
CRL::Environment::getIN_PH
const std::string & getIN_PH() const
Definition: Environment.h:123
CRL::Environment::AddMode
AddMode
Definition: Environment.h:37
CRL::Environment::getBLOCKAGE
const std::string & getBLOCKAGE() const
Definition: Environment.h:129
CRL::Environment
Holds all the Alliance environment variables.
Definition: Environment.h:35
CRL::Environment::getCATALOG
const std::string & getCATALOG() const
Definition: Environment.h:131
CRL::Environment::getLIBRARYPath
std::string getLIBRARYPath(size_t i)
CRL::Environment::setCLOCK
void setCLOCK(const char *value)
CRL::Environment::setDisplayStyle
void setDisplayStyle(const char *)
Definition: Environment.h:134
CRL::Environment::setDISPLAY
void setDISPLAY(const char *value)

Generated by doxygen 1.8.5 on Thu Mar 19 2020 | Return to top of page

Coriolis Core (CRL) | Copyright © 2008-2016 UPMC All rights reserved