Zorba
The XQuery Processor
Documentation
Live Demo
Modules
Download
Tools
Blog
Code
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
include
zorba
audit.h
Go to the documentation of this file.
1
/*
2
* Copyright 2006-2008 The FLWOR Foundation.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
#ifndef ZORBA_AUDIT_H
18
#define ZORBA_AUDIT_H
19
20
#include <iostream>
21
#include <vector>
22
#include <zorba/config.h>
23
#include <
zorba/zorba_string.h
>
24
25
namespace
zorba {
26
namespace
audit {
27
28
/**
29
* an identifier for a set of pieces of information that can be audited
30
* together.
31
* It is assumed that all instances of PropertyGroup are created statically
32
* and that they exist while a process exists.
33
*/
34
class
ZORBA_DLL_PUBLIC
PropertyGroup
{
35
public
:
36
virtual
size_t
pathLength()
const
= 0;
37
virtual
const
char
* getSegment(
size_t
)
const
= 0;
38
};
39
40
/**
41
* an identifier for a specific piece of information that can be audited.
42
* It is assumed that all instances of Property are created statically
43
* and that they exist while a process exists.
44
*/
45
class
ZORBA_DLL_PUBLIC
Property
{
46
public
:
47
enum
Type
{
48
INT
,
49
STRING
50
};
51
52
virtual
~
Property
();
53
54
virtual
const
PropertyGroup
& group()
const
= 0;
55
virtual
const
char
* name()
const
= 0;
56
virtual
long
id
()
const
= 0;
57
virtual
Type
type
()
const
= 0;
58
};
59
60
class
ZORBA_DLL_PUBLIC
Observation
{
61
public
:
62
virtual
const
Property
& property()
const
= 0;
63
virtual
const
String
& stringValue()
const
= 0;
64
virtual
long
long
longValue()
const
= 0;
65
};
66
67
class
ZORBA_DLL_PUBLIC
Configuration
{
68
public
:
69
static
void
getPropertyNames(std::vector<String>&);
70
static
size_t
getPropertyCount();
71
static
const
Property
& getProperty(
size_t
i);
72
static
bool
enableProperty(
Configuration
*,
const
std::vector<String>&,
const
String
&);
73
74
virtual
size_t
size()
const
= 0;
75
virtual
void
enableAudit(
size_t
i) = 0;
76
virtual
void
enableAudit(
const
String
& aPropertyName) = 0;
77
virtual
bool
auditEnabled(
size_t
i)
const
= 0;
78
virtual
bool
auditEnabled(
const
String
& aPropertyName)
const
= 0;
79
80
virtual
const
Property
* getDynamicProperty(
const
String
&)
const
= 0;
81
82
virtual
std::ostream& write(std::ostream&)
const
= 0;
83
84
virtual
~Configuration
() {}
85
};
86
87
class
ZORBA_DLL_PUBLIC
Record
{
88
public
:
89
virtual
const
PropertyGroup
& group()
const
= 0;
90
91
virtual
size_t
size()
const
= 0;
92
virtual
const
Observation
& at(
size_t
i)
const
= 0;
93
94
virtual
void
add(
const
Property
& prop,
long
long
val) = 0;
95
virtual
void
add(
const
Property
& prop,
const
String
& val) = 0;
96
};
97
98
class
ZORBA_DLL_PUBLIC
Event
{
99
public
:
100
static
Event
*
get
();
101
102
virtual
bool
audit(
const
Property
&)
const
= 0;
103
virtual
bool
audit(
const
String
&)
const
= 0;
104
105
virtual
const
Property
* getDynamicProperty(
const
String
&)
const
= 0;
106
107
virtual
Record
* createRecord() = 0;
108
virtual
void
submitRecord(
Record
*) = 0;
109
110
virtual
size_t
size()
const
= 0;
111
virtual
const
Record
* at(
size_t
)
const
= 0;
112
113
virtual
std::ostream& write(std::ostream&)
const
= 0;
114
115
virtual
~Event
() {}
116
};
117
118
class
ZORBA_DLL_PUBLIC
Provider
{
119
public
:
120
virtual
Configuration
* createConfiguration(
size_t
= 0) = 0;
121
virtual
void
destroyConfiguration(
Configuration
*) = 0;
122
123
virtual
Event
* createEvent(
const
Configuration
*) = 0;
124
virtual
void
submitEvent(
Event
*) = 0;
125
};
126
127
}
/* namespace audit */
128
}
/* namespace zorba */
129
130
inline
std::ostream&
operator<<
(std::ostream&
os
,
const
zorba::audit::Configuration
& c) {
131
return
c.
write
(os);
132
}
133
134
inline
std::ostream&
operator<<
(std::ostream&
os
,
const
zorba::audit::Event
& e) {
135
return
e.
write
(os);
136
}
137
138
#endif
139
/* vim:set et sw=2 ts=2: */
Please enable JavaScript to view the
comments powered by Disqus.
blog comments powered by
Disqus