atscppapi  1.0.9
C++ wrapper for Apache Traffic Server API
 All Classes Files Functions Enumerations Enumerator Macros
List of all members
atscppapi::Transaction::ContextValue Class Reference

ContextValues are a mechanism to share data between plugins using the atscppapi. More...

#include "Transaction.h"

Detailed Description

ContextValues are a mechanism to share data between plugins using the atscppapi.

Any data can be shared so long as it extends ContextValue, a simple example might be:

struct mydata : ContextValue {
int id_;
string foo_;
mydata(int id, string foo) : id_(id), foo_(foo) { }
}
Transaction.setContextValue("some-key", shared_ptr(new mydata(12, "hello")));
// From another plugin you'll have access to this contextual data:
shared_ptr<Transaction.getContextValue("some-key")

Because getContextValue() and setContextValue() take shared pointers you dont have to worry about the cleanup as that will happen automatically so long as you dont have shared_ptrs that cannot go out of scope.


The documentation for this class was generated from the following file: