aboutsummaryrefslogtreecommitdiff
path: root/src/rdf.hh
blob: b5b8ccc69bce20bd9361724fcfaa28908ff48a3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#ifndef FORMALINE_RDF_HH
#define FORMALINE_RDF_HH

#include "cctk.h"

#include <sstream>
#include <string>
#include <vector>

#include "storage.hh"



namespace Formaline
{

  typedef struct {
    std::string type;
    std::string value;
  } rdfScalarValue;

  typedef struct {
    std::string    key;
    rdfScalarValue value;
  } rdfTableEntry;

  typedef struct {
    std::string datetime;
    bool        hasCCTKinfo;
    CCTK_REAL   cctk_time;
    int         cctk_iteration;
    std::string name;
    std::string key;
// classes (with constructors) are not allowed as members of a union
//    union value {
      rdfScalarValue             scalar;
      std::vector<rdfTableEntry> table;
//    }
    bool isTable;
  } rdfPublishItem;

  // buffer to keep RDF metadata until the next Update() call
  extern std::vector<rdfPublishItem> rdfPublishList;

  // the jobID std::string
  extern std::string jobID;

  std::string clean (std::string const & txt);

  std::string cleanURI (std::string const & uri);



  class rdf : public storage
  {
    std::ostringstream msgbuf;
    std::string const groupname;
    rdf * const parent;
    
  public:
  
    rdf (char const * id,
         enum state st,
         cGH const * cctkGH,    // this should probably go away
         char const * n = "",
         rdf * par = 0);
  
    virtual
    ~ rdf ();
    
    virtual rdf *
    open_group (char const * name);
  
    virtual void
    store (char const * key,
           bool value);
  
    virtual void
    store (char const * key,
           CCTK_INT value);
  
    virtual void
    store (char const * key,
           CCTK_REAL value);
  
    virtual void
    store (char const * key,
           char const * value);
  
  private:
    
    void Initial (void);
    void Update (cGH const * cctkGH);

  };



} // namespace Formaline



#endif // ifndef FORMALINE_RDF_HH