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