Coriolis Core (CRL) Documentation


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


Generated by doxygen 1.8.14 on Sun Nov 21 2021 Return to top of page
Coriolis Core (CRL) Copyright © 2008-2020 Sorbonne Universite, All rights reserved