X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FSocketPolicy.hh;h=db8cee50f2d3704da4f2666c797478198700a105;hb=a8a6c2992968ee32cbc0244851e25b57a03a323a;hp=8dba18b1c02f00daaa2c1c7dcd10b2e2a282f5d4;hpb=aec1302f91b51edb58f8a97985ab2e0aa9c8db66;p=senf.git diff --git a/Socket/SocketPolicy.hh b/Socket/SocketPolicy.hh index 8dba18b..db8cee5 100644 --- a/Socket/SocketPolicy.hh +++ b/Socket/SocketPolicy.hh @@ -79,7 +79,7 @@ Every Policy value is identified by a class type. The policy classes themselves built an inheritance hierarchy for each policy axis. For each policy axis, the root of this tree is the class - named \i Policy \c Base (e.g. \p AddressingPolicyBase). + named \e Policy \c Base (e.g. \p AddressingPolicyBase). The senf::SocketPolicy defines the complete policy of a socket. It combines a set of policy classes, one for each policy @@ -143,7 +143,9 @@ checking, that it derives from SocketPolicyBase. This is simpler than chacking the template directly). -
\c template \c SocketPolicy < \e addressingPolicy, \e framingPolicy, \e communicationPolicy, \e readPolicy, \e writePolicy, \e bufferingPolicy >
+
\c template \c SocketPolicy < \e addressingPolicy, \e + framingPolicy, \e communicationPolicy, \e readPolicy, \e + writePolicy, \e bufferingPolicy >
This is the central SocketPolicy template. It combines a complete set of policy classes, one for each axis.
@@ -226,6 +228,14 @@ with \c SocketPolicyIsBaseOf. */ +/** \defgroup policy_impl_group Policy Implementation classes + \ingroup policy_group + + Here you will find all policy classes. Also included are some + supporting classes which are used as base classes to build other + policy classes. + */ + #ifndef HH_SocketPolicy_ #define HH_SocketPolicy_ 1 @@ -467,18 +477,34 @@ namespace senf { \internal - This class is used to + This class provides the baseclass of all socket policies + (bundles). It serves two purposes: + \li It allows us to easily identify a socket policy bundle by + checking a classes baseclass. + \li It provides an abstract (virtual) interface to access the + policy axes \see policy_group */ struct SocketPolicyBase - {}; + { + /** \brief Polymorphic access to policy axes + + This is an example of a policy axes accessor. It returns a + reference to the policy axes used by the conrecte protocol + bundle. This reference can then be checked using RTTI + information. + */ + AddressingPolicyBase const & theAddressingPolicy() const = 0; + }; /** \brief Collection of policy classes The SocketPolicy template defines the complete Policy used by the socket library. It contains one policy class for each - policy axis. + policy axis. This template takes one policy from each axis as + it's template arguments (this example implementation only has + AddressingPolicy as an argument). A SocketPolicy can be complete or incomplete. An incomplete SocketPolicy will have at least one axis set to \c Undefined @@ -490,15 +516,24 @@ namespace senf { \see policy_group */ - template < - class AddressingPolicy, - class FramingPolicy, - class CommunicationPolicy, - class ReadPolicy, - class WritePolicy, - class BufferingPolicy > + template < class AddressingPolicy > struct SocketPolicy - {}; + { + /** \brief Check dynamic policy compatibility + + This method will check the socket policy \a other against + this policy. It will check, wether \a other is a base + policy (or the same) of this policy. This check is done + against the \e dynamic type of \a other using RTTI. It + will throw \c std::bad_cast, if the policy is not + compatible. + + \param[in] other SocketPolicy to check + \throws std::bad_cast if \a other is not a compatible + policy + */ + static void checkBaseOf(SocketPolicyBase const & other); + }; /** \brief Metafunction to create SocketPolicy