Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
doc:logging:tutorials-cpp [2014/09/19 07:33] – [Using the client library] winkler | doc:logging:tutorials-cpp [2014/09/19 15:19] (current) – [Non-Default Contexts] winkler | ||
---|---|---|---|
Line 63: | Line 63: | ||
#include < | #include < | ||
#include < | #include < | ||
+ | #include < | ||
using namespace beliefstate_client; | using namespace beliefstate_client; | ||
Line 143: | Line 144: | ||
generation. | generation. | ||
+ | A resulting PDF could then look like this: | ||
+ | {{ : | ||
==== Non-Default Contexts ==== | ==== Non-Default Contexts ==== | ||
- | To override default-parameters, | + | To override default-parameters, |
* the start and end timestamps for the context timepoints, and | * the start and end timestamps for the context timepoints, and | ||
Line 154: | Line 156: | ||
<code pseudo> | <code pseudo> | ||
- | int startContext(context-name, | + | Context* Context::startContext(context-name, |
</ | </ | ||
So the time point noted in the resulting log-tree can be annotated with a custom timepoint (for non-realtime logging uses). If this parameter is omitted, the current Unix time on the system running the Beliefstate logging system is used. | So the time point noted in the resulting log-tree can be annotated with a custom timepoint (for non-realtime logging uses). If this parameter is omitted, the current Unix time on the system running the Beliefstate logging system is used. | ||
- | The same accounts for the '' | + | The same accounts for the '' |
<code pseudo> | <code pseudo> | ||
- | int endContext(context-name, | + | void Context:: |
</ | </ | ||
The success flag is by default set to '' | The success flag is by default set to '' | ||
Line 170: | Line 172: | ||
<code pseudo> | <code pseudo> | ||
- | int startContext(context-name, | + | Context* Context::startContext(context-name, |
</ | </ | ||
Line 185: | Line 187: | ||
In you C++-program, | In you C++-program, | ||
<code cpp> | <code cpp> | ||
- | int nCtx = bscl-> | + | Context* ctxContext |
- | bscl->endContext(nCtx, 10) | + | ctxContext->end(true, 10) |
</ | </ | ||
- | Of course, for real-time purposes (or if you don't care about the timestamps), | + | Of course, for real-time purposes (or if you don't care about the timestamps), |
=== Issueing Discrete Events === | === Issueing Discrete Events === | ||
- | When your application requires the issuance of discrete, momentarily events you can use the convenience function discreteEvent: | + | When your application requires the issuance of discrete, momentarily events you can use the convenience function |
<code pseudo> | <code pseudo> | ||
- | int discreteEvent(event-name, | + | void Context::discreteEvent(event-name, |
</ | </ | ||
Line 211: | Line 213: | ||
should be added to the current context. To achieve this, in your program, call these lines while you are in the appropriate context: | should be added to the current context. To achieve this, in your program, call these lines while you are in the appropriate context: | ||
<code cpp> | <code cpp> | ||
- | bscl-> | + | ctxContext-> |
- | bscl-> | + | ctxContext-> |
</ | </ | ||
The resulting '' | The resulting '' | ||
Line 256: | Line 258: | ||
< | < | ||
< | < | ||
- | < | + | < |
- | < | + | < |
</ | </ | ||
</ | </ | ||
This is achieved by using the following, simple code: | This is achieved by using the following, simple code: | ||
<code cpp> | <code cpp> | ||
- | int nID = bscl-> | + | Context* ctxInCtct |
Object* objCup = new Object("& | Object* objCup = new Object("& | ||
- | bscl-> | + | ctxInCtct-> |
Object* objTable = new Object("& | Object* objTable = new Object("& | ||
- | bscl-> | + | ctxInCtct-> |
delete objCup; | delete objCup; | ||
delete objTable; | delete objTable; | ||
- | bscl->endContext(nID); | + | ctxInCtct->end(); |
</ | </ | ||
Additionally, | Additionally, | ||
<code xml> | <code xml> | ||
- | < | + | < |
< | < | ||
< | < | ||
</ | </ | ||
- | < | + | < |
< | < | ||
< | < | ||
Line 293: | Line 295: | ||
If they are left out, the object will be of type ''& | If they are left out, the object will be of type ''& | ||
<code pseudo> | <code pseudo> | ||
- | addObject(object, | + | void Context::addObject(object, |
</ | </ | ||
produces the actual addition of the object reference to the current context (and creation of the object individual). The optional '' | produces the actual addition of the object reference to the current context (and creation of the object individual). The optional '' | ||
+ | |||
+ | |||
+ | === Registering custom OWL namespaces === | ||
+ | |||
+ | When using custom namespaces in the entity class definitions, | ||
+ | <code cpp> | ||
+ | bscl-> | ||
+ | </ | ||
+ | with both parameters representing your use-case, of course. | ||
+ | |||
+ | Custom namespaces can therefore be registered by calling | ||
+ | '' | ||
+ | where the shortcut is the short version of the namespace, i.e. '' | ||
+ | ==== Sample Program ==== | ||
+ | |||
+ | A complete sample program depicting the '' |