3 #ifndef STREAMBASE_SCHEMA_H 
    4 #define STREAMBASE_SCHEMA_H 
    6 #if !(defined(WIN32) || defined(__APPLE__)) 
   10 #include "StreamBase.hpp" 
   14 #include "Exceptions.hpp" 
   15 #include "SBHashMap.hpp" 
   17 SB_INTERNAL_FWD(SchemaUtil);
 
   18 SB_INTERNAL_FWD(Errors);
 
   42     size_t operator()(
const std::string &str)
 const 
   44         const std::string::value_type *buffer = str.data();
 
   46         for (
unsigned int i = 0; i < str.size(); i++)
 
   49             hashcode = (37 * hashcode) + *(buffer++);
 
   65     static const int HASH_LENGTH = 16; 
 
   72     static const int HEADER_SIZE = 4;
 
   77     static const Schema EMPTY_SCHEMA;
 
   98     template <
typename Iterator>
 
   99     Schema(std::string name, Iterator begin, Iterator end, Flags flags = Flags());
 
  102     template <
typename Iterator>
 
  103     Schema(Iterator begin, Iterator end, Flags flags = Flags());
 
  107     Schema(std::string name, 
const std::vector<Field>& fields, Flags flags = Flags());
 
  111     Schema(
const std::vector<Field>& fields, Flags flags = Flags());
 
  117     typedef QUALIFIED_SB_HASH_MAP<std::string, int, StringHashFunc> FieldIndexMap;
 
  118     typedef QUALIFIED_SB_HASH_MAP<std::string, Field, StringHashFunc> FieldPathMap;
 
  135     operator const void *() 
const { 
return _isInitialized ? _rep.get() : (
const void*) NULL; }
 
  150     size_t getNullMaskSize() 
const;
 
  153     size_t getNullMaskOffset()
 const {
 
  165     const Field& getField(
size_t field_num) 
const;
 
  171     const Field& getField(
const std::string &pathName) 
const;
 
  177         const bool hasField(
const std::string &pathName) 
const;
 
  180     const std::vector<Field>& getFields() 
const;
 
  184     int indexOfField(
const std::string &name) 
const;
 
  187     const std::string &getName() 
const;
 
  190     size_t getNumFields() 
const;
 
  193     std::string as_string() 
const;
 
  201     std::string as_xml(std::string name = std::string(), 
bool aAddUUID = 
true) 
const;
 
  206     bool sameFieldTypes(
const Schema& other) 
const;
 
  210     bool sameFields(
const Schema& other) 
const;
 
  214     static Schema fromXml(
const std::string &input, Flags flags = Flags());
 
  216     bool operator == (
const Schema& other) 
const;
 
  217     bool operator != (
const Schema& other)
 const {
 
  218         return !(*
this == other);
 
  224     void addField(
const Field& f);
 
  228     template <
typename Iterator>
 
  229     void addFields(Iterator begin, Iterator end) {
 
  231             addField(*(begin++));
 
  234     void resolveFieldPathName(
const std::string& pathName, std::vector<Field>& fields) 
const;
 
  237     TIBCO_CEP_memory::shared_ptr<SchemaRep> _rep;
 
  239     friend class sb_internal::SchemaUtil;
 
  240     friend class SchemaRep;
 
  245 inline std::ostream& operator << (std::ostream& os, 
const sb::Schema& schema) {