1 #ifndef SAUCE_INTERNAL_TYPE_ID_H_
2 #define SAUCE_INTERNAL_TYPE_ID_H_
8 #include <sauce/exceptions.h>
23 typedef void (*TypeSignature)();
28 template<
typename Type>
29 void TypeSignatureFactory() {}
35 TypeSignature signature;
42 explicit TypeId(TypeSignature
const & signature):
43 signature(signature) {}
49 bool operator==(
TypeId const &
id)
const {
50 return signature ==
id.signature;
53 bool operator!=(
TypeId const &
id)
const {
54 return signature !=
id.signature;
57 bool operator<(
TypeId const &
id)
const {
58 return signature <
id.signature;
69 template<
typename Type>
75 template<
typename Type>
77 friend TypeId typeIdOf<Type>();
80 TypeId(&TypeSignatureFactory<Type>) {}
92 template<
typename Type>
100 typedef std::pair<TypeId, std::string> NamedTypeId;
105 template<
typename Type>
106 NamedTypeId namedTypeIdOf(std::string
const name) {
107 return std::make_pair(typeIdOf<Type>(), name);
113 typedef std::set<NamedTypeId> TypeIds;
117 namespace i = ::sauce::internal;
121 #endif // SAUCE_INTERNAL_TYPE_ID_H_
Thrown when a provision is requested outside of its given, bound scope.
Definition: exceptions.h:85
The TypeId derived class that acknowledges the hidden type.
Definition: type_id.h:76
virtual void throwOutOfScopeException() const
Throw an OutOfScopeException appropriate for the hidden type, assuming it is a Scope.
Definition: type_id.h:64
void throwOutOfScopeException() const
Throw an OutOfScopeException appropriate for the hidden type, assuming it is a Scope.
Definition: type_id.h:84
Thrown when a provision is requested outside of its bound scope.
Definition: exceptions.h:75
A TypeSignature equipped with specific helper methods dealing in the hidden type. ...
Definition: type_id.h:34