source: trunk/FACT++/src/DimDescriptionService.h@ 10979

Last change on this file since 10979 was 10632, checked in by tbretz, 13 years ago
Replaced old with new constructors.
File size: 1.5 KB
Line 
1#ifndef FACT_DimDescriptionService
2#define FACT_DimDescriptionService
3
4#include <string>
5
6class DimService;
7
8class DimDescriptionService
9{
10 static int fCount; /// Counter to count the number of instatiations
11 static DimService *fService; /// Pointer to the DimService distributing the desscriptions
12 static std::string fData; /// Data to be distributed with the service
13
14 std::string fDescription; /// Local storage for the applied description
15
16public:
17 DimDescriptionService(const std::string &name, const std::string &format);
18 ~DimDescriptionService();
19
20 std::string GetDescription() const { return fDescription; }
21};
22
23#include "dis.hxx"
24
25class DimDescribedService : public DimDescriptionService, public DimService
26{
27public:
28 template<typename T>
29 DimDescribedService(const std::string &name, const T &val, const char *desc)
30 : DimDescriptionService(name.c_str(), desc), DimService(name.c_str(), const_cast<T&>(val))
31 {
32 }
33
34 template<typename T>
35 DimDescribedService(const std::string &name, const char *format, const T &val, const char *desc)
36 : DimDescriptionService(name.c_str(), desc), DimService(name.c_str(), format, const_cast<T*>(&val), sizeof(T))
37 {
38 }
39
40 DimDescribedService(const std::string &name, const char *format, const char *desc)
41 : DimDescriptionService(name.c_str(), desc), DimService(name.c_str(), format, (void*)NULL, 0)
42 {
43 // FIXME: compare number of ; with number of |
44 }
45};
46
47#endif
Note: See TracBrowser for help on using the repository browser.