OKlibrary  0.2.1.6
ResultElements.hpp
Go to the documentation of this file.
00001 // Oliver Kullmann, 11.6.2005 (Swansea)
00002 /* Copyright 2005 - 2007 Oliver Kullmann
00003 This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
00004 it and/or modify it under the terms of the GNU General Public License as published by
00005 the Free Software Foundation and included in this library; either version 3 of the
00006 License, or any later version. */
00007 
00018 #ifndef RESULTELEMENT_6Tg5Yh
00019 #define RESULTELEMENT_6Tg5Yh
00020 
00021 #include <OKlib/Concepts/LibraryBasics.hpp>
00022 
00023 #include <OKlib/Experimentation/Competition/traits/string_type.hpp>
00024 #include <OKlib/Experimentation/Competition/traits/floating_point_type.hpp>
00025 #include <OKlib/Experimentation/Competition/traits/natural_number_type.hpp>
00026 
00027 namespace OKlib {
00028 
00029   namespace Concepts {
00030 
00038     struct ResultElement_tag : virtual BasicRequirements_tag, virtual FullyConstructible_tag {};
00039 
00040     template <typename Res>
00041     struct ResultElement {
00042       typedef typename OKlib::SATCompetition::traits::string_type<Res>::type string_type;
00043       typedef typename OKlib::SATCompetition::traits::floating_point_type<Res>::type floating_point_type;
00044       typedef typename OKlib::SATCompetition::traits::natural_number_type<Res>::type natural_number_type;
00045       void constraints() {
00046         OKLIB_MODELS_CONCEPT_TAG(Res, ResultElement);
00047 
00048         OKLIB_MODELS_CONCEPT_REQUIRES(Res, BasicRequirements);
00049         OKLIB_MODELS_CONCEPT_TAG(Res, BasicRequirements);
00050         OKLIB_MODELS_CONCEPT_REQUIRES(Res, FullyConstructible);
00051         OKLIB_MODELS_CONCEPT_TAG(Res, FullyConstructible);
00052       }
00053     };
00054 
00055     class ResultElement_Archetype {
00056       struct X {};
00057       struct Y {};
00058       struct Z {};
00059     public :
00060       typedef ResultElement_tag concept_tag;
00061       typedef X string_type;
00062       typedef Y floating_point_type;
00063       typedef Z natural_number_type;
00064     };
00065     
00066     // --------------------------------------------------------------------------------------------------------------------------------------
00067 
00073     struct ResultElementWithOrder_tag : virtual ResultElement_tag, virtual EqualitySubstitutable_tag, virtual LinearOrder_tag {};
00074 
00075     template <typename Res>
00076     struct ResultElementWithOrder {
00077       void constraints() {
00078         OKLIB_MODELS_CONCEPT_TAG(Res, ResultElementWithOrder);
00079 
00080         OKLIB_MODELS_CONCEPT_REQUIRES(Res, ResultElement);
00081         OKLIB_MODELS_CONCEPT_TAG(Res, ResultElement);
00082         OKLIB_MODELS_CONCEPT_REQUIRES(Res, EqualitySubstitutable);
00083         OKLIB_MODELS_CONCEPT_TAG(Res, EqualitySubstitutable);
00084         OKLIB_MODELS_CONCEPT_REQUIRES(Res, LinearOrder);
00085         OKLIB_MODELS_CONCEPT_TAG(Res, LinearOrder);
00086       }
00087     };
00088 
00089     class ResultElementWithOrder_Archetype : public ResultElement_Archetype {
00090     protected :
00091       struct convertible_to_bool {
00092         operator bool() { return bool(); }
00093       };
00094     public :
00095       typedef ResultElementWithOrder_tag concept_tag;
00096       convertible_to_bool operator ==(const ResultElementWithOrder_Archetype&) const { return convertible_to_bool(); }
00097       convertible_to_bool operator !=(const ResultElementWithOrder_Archetype&) const { return convertible_to_bool(); }
00098       convertible_to_bool operator <(const ResultElementWithOrder_Archetype&) const { return convertible_to_bool(); }
00099       convertible_to_bool operator >(const ResultElementWithOrder_Archetype&) const { return convertible_to_bool(); }
00100       convertible_to_bool operator <=(const ResultElementWithOrder_Archetype&) const { return convertible_to_bool(); }
00101       convertible_to_bool operator >=(const ResultElementWithOrder_Archetype&) const { return convertible_to_bool(); }
00102     };
00103     
00104     // --------------------------------------------------------------------------------------------------------------------------------------
00105 
00113     struct ResultElementWithName_tag : virtual ResultElementWithOrder_tag {};
00114 
00115     template <typename Res>
00116     struct ResultElementWithName {
00117       typedef typename ::OKlib::SATCompetition::traits::string_type<Res>::type string_type;
00118       void constraints() {
00119         OKLIB_MODELS_CONCEPT_TAG(Res, ResultElementWithName);
00120 
00121         OKLIB_MODELS_CONCEPT_REQUIRES(Res, ResultElementWithOrder);
00122         OKLIB_MODELS_CONCEPT_TAG(Res, ResultElementWithOrder);
00123 
00124         OKLIB_MODELS_CONCEPT_REQUIRES(string_type, ConstCorrect);
00125         OKLIB_MODELS_CONCEPT_REQUIRES(string_type, EqualitySubstitutable);
00126         OKLIB_MODELS_CONCEPT_REQUIRES(string_type, LinearOrder);
00127         OKLIB_MODELS_CONCEPT_REQUIRES(string_type, FullyConstructible);
00128 
00129         Res(s);
00130         Res(sc);
00131         static_cast<string_type>(r.name());
00132         static_cast<string_type>(rc.name());
00133       }
00134       string_type s; const string_type sc;
00135       Res r; const Res rc;
00136     };
00137 
00138     class ResultElementWithName_Archetype : public ResultElementWithOrder_Archetype {
00139     public :
00140       struct string_type {
00141     protected :
00142         struct convertible_to_bool {
00143           operator bool() { return bool(); }
00144         };
00145       public :
00146         convertible_to_bool operator ==(const string_type&) const { return convertible_to_bool(); }
00147         convertible_to_bool operator !=(const string_type&) const { return convertible_to_bool(); }
00148         convertible_to_bool operator <(const string_type&) const { return convertible_to_bool(); }
00149         convertible_to_bool operator >(const string_type&) const { return convertible_to_bool(); }
00150         convertible_to_bool operator <=(const string_type&) const { return convertible_to_bool(); }
00151         convertible_to_bool operator >=(const string_type&) const { return convertible_to_bool(); }
00152       };
00153       typedef ResultElementWithName_tag concept_tag;
00154       ResultElementWithName_Archetype() {}
00155       ResultElementWithName_Archetype(const string_type&) {}
00156       string_type name() const { return string_type(); }
00157     };
00158     
00159     // --------------------------------------------------------------------------------------------------------------------------------------
00160 
00161     
00162   }
00163 
00164 }
00165 
00166 #endif