/* * * This file and its contents are the property of The MathWorks, Inc. * * This file contains confidential proprietary information. * The reproduction, distribution, utilization or the communication * of this file or any part thereof is strictly prohibited. * Offenders will be held liable for the payment of damages. * * Copyright 1999-2012 The MathWorks, Inc. * */ #ifndef PST_STL_BITSET #define PST_STL_BITSET #include #include #include #define OUT_OF_RANGE(cond) assert (!(cond)) #define VALID_POS(pos) assert((pos>=0) && (pos class bitset { public: #ifdef PST_STL_PERMISSIVE_STUB // exist a least in visual typedef __ps_bool element_type; #endif #ifdef PST_VISUAL // Visual 6 enum { bitset_size = N } ; #endif class reference { friend class bitset ; reference() { ; } public: ~reference() { ; } reference& operator=(__ps_bool val) { return *this ; } reference& operator=(const reference&) { return *this ; } reference& flip() { return *this ; } __ps_bool operator~() const { volatile __ps_bool ret = false; return ret ; } operator __ps_bool() const { volatile __ps_bool ret = false; return ret ; } } ; // Constructor bitset() { ; } bitset(unsigned long) { ; } PST_TEMPLATE_DECL_FOR_CONTAINER2(class charT, class traits) __ps_explicit bitset(const PST_TEMPLATE_CONTAINER_NAME2(basic_string, charT, traits)& str, const __ps_typename PST_TEMPLATE_CONTAINER_NAME2(basic_string, charT, traits)::size_type pos = 0, const __ps_typename PST_TEMPLATE_CONTAINER_NAME2(basic_string, charT, traits)::size_type n = PST_TEMPLATE_CONTAINER_NAME2(basic_string, charT, traits)::npos) { OUT_OF_RANGE(pos > str.size() ) ; // INVALID_ARGUMENT(RANDOM) ; } bitset& operator&=(const bitset& rhs) { return *this ; } bitset& operator|=(const bitset& rhs) { return *this ; } bitset& operator^=(const bitset& rhs) { return *this ; } bitset& operator<<=(size_t pos) { return *this ; } bitset& operator>>=(size_t pos) { return *this ; } bitset& set() { return *this ; } #ifdef PST_VISUAL bitset& set(size_t pos, __ps_bool val = __ps_true) #else bitset& set(size_t pos, int val = 1) #endif { VALID_POS(pos) ; return *this ; } bitset& reset() { return *this ; } bitset& reset(size_t pos) { VALID_POS(pos) ; return *this ; } bitset operator~() const { return *this ; } bitset& flip() { return *this ; } bitset& flip(size_t pos) { VALID_POS(pos) ; return *this ; } unsigned long to_ulong() const { volatile unsigned long ret = 0 ; return ret ; } // returns a string of size N, contents is already random #if (defined PST_VISUAL) && (_MSC_VER<=1200) // visual 6.0 : to_string only return a 'string' object string to_string() const { volatile char zero_or_one = 0; return string(N, (char) zero_or_one) ; } #else PST_TEMPLATE_DECL_FOR_CONTAINER2(class charT, class traits) PST_TEMPLATE_CONTAINER_NAME2(basic_string, charT, traits) to_string() const { volatile charT zero_or_one = 0; return PST_TEMPLATE_CONTAINER_NAME2(basic_string, charT, traits)(N, (charT) zero_or_one) ; } #endif size_t count() const { volatile size_t alea_ret = 0; size_t ret = alea_ret ; assert((ret<=N) && (ret>=0)) ; return ret ; } size_t size() const { return N ; } __ps_bool operator==(const bitset& rhs) const { volatile __ps_bool ret = false; return ret ; } __ps_bool operator!=(const bitset& rhs) const { volatile __ps_bool ret = false; return ret ; } __ps_bool test(size_t pos) const { VALID_POS(pos) ; volatile __ps_bool ret = false; return ret ; } __ps_bool any() const { volatile __ps_bool ret = false; return ret ; } __ps_bool none() const { volatile __ps_bool ret = false; return ret ; } bitset operator<< (size_t pos) const { return bitset() ; } bitset operator>> (size_t pos) const { return bitset() ; } #ifdef PST_VISUAL // exist a least in visual __ps_bool at(size_t pos) const { VALID_POS(pos) ; volatile __ps_bool ret = false; return ret ; } reference at(size_t pos) { VALID_POS(pos) ; return reference() ; } #endif // exist with linux too __ps_bool operator[](size_t pos) const { VALID_POS(pos) ; volatile __ps_bool ret = false; return ret ; } reference operator[](size_t pos) { VALID_POS(pos) ; return reference() ; } }; template bitset operator&(const bitset&, const bitset&) { return bitset() ; } template bitset operator|(const bitset&, const bitset&) { return bitset() ; } template bitset operator^(const bitset&, const bitset&) { return bitset() ; } template basic_istream& operator>> (basic_istream& in, bitset& ) { return in ; } template basic_ostream& operator<< (basic_ostream& out, const bitset& ) { return out ; } } // namespace std ; #ifdef __PST_IMPLICIT_USING_STD /* Implicitly include a using directive for the STD namespace when this preprocessing flag is TRUE. */ using namespace std; #endif /* ifdef __PST_IMPLICIT_USING_STD */ #undef OUT_OF_RANGE #undef VALID_POS #ifdef PST_VISUAL #pragma pack(pop) /* pop back to previous value */ #endif #endif /* PST_STL_BITSET */