00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00025 #ifndef RCUCONF_ADDRESS_H
00026 #define RCUCONF_ADDRESS_H
00027 #ifndef RCUCONF_TABLE_H
00028 # include <rcuconf/Table.h>
00029 #endif
00030 #ifndef __LIST__
00031 # include <list>
00032 #endif
00033
00034 namespace RcuDb
00035 {
00036 class Row;
00037 class Sql;
00038 }
00039
00040
00041 namespace RcuConf
00042 {
00043
00044 class Value;
00045
00051 class Address : public Table
00052 {
00053 public:
00058 Address(int board, int chip=0, int channel=0)
00059 : fAddress(((board & 0x1F) << 7) +
00060 ((chip & 0x07) << 4) +
00061 ((channel & 0x0F)))
00062 {}
00064 virtual ~Address() { }
00065
00067 typedef std::list<Address*> List;
00068
00070 virtual void Print() const;
00073 virtual bool Insert(RcuDb::Server& s);
00076 static bool Create(RcuDb::Server& s);
00079 static bool Drop(RcuDb::Server& s);
00085 static bool Select(List& l, RcuDb::Server& s, const RcuDb::Sql& cond);
00091 static bool Select(List& l, RcuDb::Server& s, const Value& v);
00092
00094 int Board() const { return (fAddress >> 7) & 0x1f; }
00096 int Chip() const { return (fAddress >> 4) & 0x7; }
00098 int Channel() const { return (fAddress & 0xf); }
00100 int RawValue() const { return fAddress; }
00101 protected:
00104 Address(RcuDb::Row& row);
00106 int fAddress;
00107 };
00108 }
00109
00110 #endif
00111
00112
00113
00114
00115