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
24namespace CRL {
25
26 using Hurricane::JsonObject;
27 using Hurricane::JsonStack;
28
29
30// -------------------------------------------------------------------
31// Class : "Environment".
32
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.
42 // Accessors.
43 inline const std::string& getDisplayStyle () const;
44 inline long getSCALE_X () const;
45 inline const std::string& getDISPLAY () const;
46 inline const std::string& getIN_LO () const;
47 inline const std::string& getIN_PH () const;
48 inline const std::string& getOUT_LO () const;
49 inline const std::string& getOUT_PH () const;
50 inline const std::string& getPOWER () const;
51 inline const std::string& getGROUND () const;
52 inline const std::string& getCLOCK () const;
53 inline const std::string& getBLOCKAGE () const;
54 inline const std::string& getPad () const;
55 inline const std::string& getRegister () 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 bool isRegister ( const char* name ) const;
66 // Modifiers.
67 void validate () const;
68 inline void setDisplayStyle ( const char* );
69 inline void setSCALE_X ( long value );
70 inline void setDISPLAY ( const char* value );
71 inline void setIN_LO ( const char* value );
72 inline void setIN_PH ( const char* value );
73 inline void setOUT_LO ( const char* value );
74 inline void setOUT_PH ( const char* value );
75 void setPOWER ( const char* value );
76 void setGROUND ( const char* value );
77 void setCLOCK ( const char* value );
78 void setBLOCKAGE ( const char* value );
79 void setPad ( const char* value );
80 void setRegister ( 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 _displayStyle;
93 long _SCALE_X;
94 std::string _IN_LO;
95 std::string _IN_PH;
96 std::string _OUT_LO;
97 std::string _OUT_PH;
98 std::string _CATALOG;
99 std::string _POWER;
100 std::string _GROUND;
101 std::string _CLOCK;
102 std::string _BLOCKAGE;
103 std::string _pad;
104 std::string _register;
105 SearchPath _LIBRARIES;
106 regex_t* _PowerRegex;
107 regex_t* _GroundRegex;
108 regex_t* _ClockRegex;
109 regex_t* _BlockageRegex;
110 regex_t* _padRegex;
111 regex_t* _registerRegex;
112 private:
113 void _setRegex ( regex_t*& regex, const std::string& pattern, const char* name );
114 };
115
116
117 // Inline Member Functions.
118 inline const std::string& Environment::getDisplayStyle () const { return _displayStyle; }
119 inline long Environment::getSCALE_X () const { return _SCALE_X; }
120 inline const std::string& Environment::getIN_LO () const { return _IN_LO; }
121 inline const std::string& Environment::getIN_PH () const { return _IN_PH; }
122 inline const std::string& Environment::getOUT_LO () const { return _OUT_LO; }
123 inline const std::string& Environment::getOUT_PH () const { return _OUT_PH; }
124 inline const std::string& Environment::getPOWER () const { return _POWER; }
125 inline const std::string& Environment::getGROUND () const { return _GROUND; }
126 inline const std::string& Environment::getCLOCK () const { return _CLOCK; }
127 inline const std::string& Environment::getBLOCKAGE () const { return _BLOCKAGE; }
128 inline const std::string& Environment::getPad () const { return _pad; }
129 inline const std::string& Environment::getRegister () const { return _register; }
130 inline const std::string& Environment::getCATALOG () const { return _CATALOG; }
131 inline SearchPath& Environment::getLIBRARIES () { return _LIBRARIES; }
132
133 inline void Environment::setDisplayStyle ( const char* value ) { _displayStyle = value; }
134 inline void Environment::setSCALE_X ( long value ) { _SCALE_X = value; }
135 inline void Environment::setIN_LO ( const char* value ) { _IN_LO = value; }
136 inline void Environment::setIN_PH ( const char* value ) { _IN_PH = value; }
137 inline void Environment::setOUT_LO ( const char* value ) { _OUT_LO = value; }
138 inline void Environment::setOUT_PH ( const char* value ) { _OUT_PH = value; }
139 inline void Environment::setCATALOG ( const char* value ) { _CATALOG = value; }
140 inline std::string Environment::_getTypeName () const { return "Environment"; }
141
142
143// -------------------------------------------------------------------
144// Class : "JsonEnvironment".
145
146 class JsonEnvironment : public JsonObject {
147 public:
148 static void initialize ();
149 JsonEnvironment ( unsigned long flags );
150 virtual std::string getTypeName () const;
151 virtual JsonEnvironment* clone ( unsigned long flags ) const;
152 virtual void toData ( JsonStack& );
153 };
154
155
156} // CRL namespace.
157
158
159INSPECTOR_P_SUPPORT(CRL::Environment);
Holds all the Alliance environment variables.
Definition Environment.h:33
void setCATALOG(const char *value)
Definition Environment.h:139
void setPad(const char *value)
const std::string & getOUT_PH() const
Definition Environment.h:123
const std::string & getGROUND() const
Definition Environment.h:125
const std::string & getBLOCKAGE() const
Definition Environment.h:127
void setOUT_PH(const char *value)
Definition Environment.h:138
const std::string & getDisplayStyle() const
Definition Environment.h:118
void setWORKING_LIBRARY(const char *value)
const std::string & getIN_PH() const
Definition Environment.h:121
const std::string & getCATALOG() const
Definition Environment.h:130
bool isGROUND(const char *name) const
void validate() const
void setOUT_LO(const char *value)
Definition Environment.h:137
std::string getLIBRARYPath(size_t i)
const std::string & getPad() const
Definition Environment.h:128
void setIN_PH(const char *value)
Definition Environment.h:136
void setDISPLAY(const char *value)
bool isBLOCKAGE(const char *name) const
void addSYSTEM_LIBRARY(const char *value, const char *libName, unsigned int mode=Append)
const std::string & getPOWER() const
Definition Environment.h:124
void setCLOCK(const char *value)
const std::string & getOUT_LO() const
Definition Environment.h:122
void setDisplayStyle(const char *)
Definition Environment.h:133
bool isPad(const char *name) const
bool isCLOCK(const char *name) const
std::string getPrint() const
bool isPOWER(const char *name) const
const std::string & getDISPLAY() const
const std::string & getCLOCK() const
Definition Environment.h:126
AddMode
Definition Environment.h:35
@ Replace
Definition Environment.h:35
@ Append
Definition Environment.h:35
@ Prepend
Definition Environment.h:35
void setGROUND(const char *value)
const std::string & getIN_LO() const
Definition Environment.h:120
SearchPath & getLIBRARIES()
Definition Environment.h:131
void setSCALE_X(long value)
Definition Environment.h:134
void setIN_LO(const char *value)
Definition Environment.h:135
long getSCALE_X() const
Definition Environment.h:119
void setPOWER(const char *value)
void setBLOCKAGE(const char *value)
An ordered list of search pathes.
Definition SearchPath.h:32
The namespace of Coriolis Core.
Definition AcmSigda.h:28


Generated by doxygen 1.13.2 on Fri Sep 27 2024 Return to top of page
Coriolis Core (CRL) Copyright © 2008-2020 Sorbonne Universite, All rights reserved