File Information
Library: RemotingNG
Package: Transport
Header: Poco/RemotingNG/Context.h
Description
Inheritance
Direct Base Classes: Poco::RefCountedObject
All Base Classes: Poco::RefCountedObject
Member Summary
Member Functions: begin, clearCredentials, end, find, get, getCredentials, getValue, has, set, setCredentials, setValue
Inherited Functions: duplicate, referenceCount, release
Types Aliases
Attributes
using Attributes = std::map < std::string, Poco::Any >;
Ptr
using Ptr = Poco::AutoPtr < Context >;
Constructors
Context
Context();
Creates an empty Context.
Destructor
~Context
~Context();
Destroys the Context.
Member Functions
begin
Attributes::const_iterator begin() const;
Returns the begin iterator for attributes.
clearCredentials
void clearCredentials();
Clears the Credentials associated with the Context.
end
Attributes::const_iterator end() const;
Returns the end iterator for attributes.
find
Attributes::const_iterator find(
const std::string & key
) const;
Searches for an attribute. Returns end() if not found.
get
static Context::Ptr get();
get
const Poco::Any & get(
const std::string & key
) const;
Returns the attribute with the given key.
Throws a Poco::NotFoundException if the attribute does not exist.
getCredentials
const Credentials & getCredentials() const;
Returns the Credentials associated with the Context.
getValue
template < typename T > T getValue(
const std::string & key
) const;
Convenience function that returns the attribute with the given key, casted to the desired type.
Throws a Poco::NotFoundException if the attribute does not exist. Throws a Poco::BadCastException if the cast is invalid.
getValue
template < typename T > T getValue(
const std::string & key,
T deflt
) const;
Convenience function that returns the attribute with the given key, casted to the desired type. If the attribute does not exist, the given default value is returned.
Throws a Poco::BadCastException if the cast is invalid.
has
bool has(
const std::string & key
) const;
Returns true if and only if the Context has an attribute with the given value.
set
static void set(
Context::Ptr pContext
);
Sets the Context object for the current thread.
set
void set(
const std::string & key,
const Poco::Any & value
);
Sets/Overwrites an attribute value.
setCredentials
void setCredentials(
const Credentials & creds
);
Sets the Credentials associated with the Context.
setValue
template < typename T > void setValue(
const std::string & key,
T value
);
Sets/Overwrites an attribute value.