CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LMFColor.h
Go to the documentation of this file.
1 #ifndef LMFCOLOR_H
2 #define LMFCOLOR_H
3 
4 /*
5  Last updated by Giovanni.Organtini@roma1.infn.it 2010
6  */
7 
8 #include <list>
9 
11 
12 class LMFColor : public LMFUnique {
13  public:
14  friend class EcalCondDBInterface;
15 
16  LMFColor();
17  LMFColor(oracle::occi::Environment* env,
18  oracle::occi::Connection* conn);
20  LMFColor(EcalDBConnection *c, std::string col);
21  ~LMFColor();
22 
23  LMFColor& setName(const std::string &s = "blue") {
24  setString("sname", s);
25  fetchID();
26  if (m_ID <= 0) {
27  setInt("color", -1);
28  }
29  return *this;
30  }
32  setInt("color", index);
33  fetchID();
34  if (m_ID <= 0) {
35  setString("sname", "invalid");
36  }
37  return *this;
38  }
39  LMFColor& setColor(const std::string &s = "blue") {
40  setName(s);
41  return *this;
42  }
43 
44  std::string getShortName() const { return getString("sname"); }
45  std::string getLongName() const { return getString("lname"); }
46  int getColorIndex() const { return getInt("color"); }
47  int getColor() const { return getColorIndex(); }
48 
49  bool isValid();
50 
51  // Operators
52  inline bool operator==(const LMFColor &m) const
53  {
54  return ( getShortName() == m.getShortName() &&
55  getLongName() == m.getLongName());
56  }
57 
58  inline bool operator!=(const LMFColor &m) const { return !(*this == m); }
59 
60  private:
61  std::string fetchIdSql(Statement *stmt);
62  std::string fetchAllSql(Statement *stmt) const;
63  std::string setByIDSql(Statement *stmt, int id);
64  void getParameters(ResultSet *rset);
65  LMFUnique *createObject() const;
66 };
67 
68 #endif
std::string fetchAllSql(Statement *stmt) const
Definition: LMFColor.cc:51
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:33
std::string fetchIdSql(Statement *stmt)
Definition: LMFColor.cc:64
LMFColor & setName(const std::string &s="blue")
Definition: LMFColor.h:23
void getParameters(ResultSet *rset)
Definition: LMFColor.cc:95
bool operator==(const LMFColor &m) const
Definition: LMFColor.h:52
int getInt(std::string fieldname) const
Definition: LMFUnique.cc:203
std::string getLongName() const
Definition: LMFColor.h:45
int fetchID()
Definition: LMFUnique.cc:213
std::string setByIDSql(Statement *stmt, int id)
Definition: LMFColor.cc:87
oracle::occi::Statement Statement
Definition: LMFUnique.h:20
std::string getShortName() const
Definition: LMFColor.h:44
LMFUnique & setString(std::string key, std::string value)
Definition: LMFUnique.cc:15
int getColor() const
Definition: LMFColor.h:47
bool isValid()
Definition: LMFColor.cc:101
LMFColor & setColor(const std::string &s="blue")
Definition: LMFColor.h:39
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:21
LMFColor()
Definition: LMFColor.cc:9
int getColorIndex() const
Definition: LMFColor.h:46
oracle::occi::Statement * stmt
std::string getString(std::string fieldname) const
Definition: LMFUnique.cc:194
bool operator!=(const LMFColor &m) const
Definition: LMFColor.h:58
LMFColor & setColor(int index)
Definition: LMFColor.h:31
~LMFColor()
Definition: LMFColor.cc:47
tuple conn
Definition: results_mgr.py:53
LMFUnique * createObject() const
Definition: LMFColor.cc:58