BLPAPI C++ 3.25.7
Loading...
Searching...
No Matches
blpapi_schema.h
Go to the documentation of this file.
1/* Copyright 2012. Bloomberg Finance L.P.
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to
5 * deal in the Software without restriction, including without limitation the
6 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 * sell copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions: The above
9 * copyright notice and this permission notice shall be included in all copies
10 * or substantial portions of the Software.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
18 * IN THE SOFTWARE.
19 */
20
28#ifndef INCLUDED_BLPAPI_SCHEMA
29#define INCLUDED_BLPAPI_SCHEMA
30
73#ifndef INCLUDED_BLPAPI_CONSTANT
74#include <blpapi_constant.h>
75#endif
76
77#ifndef INCLUDED_BLPAPI_DEFS
78#include <blpapi_defs.h>
79#endif
80
81#ifndef INCLUDED_BLPAPI_EXCEPTION
82#include <blpapi_exception.h>
83#endif
84
85#ifndef INCLUDED_BLPAPI_NAME
86#include <blpapi_name.h>
87#endif
88
89#ifndef INCLUDED_BLPAPI_STREAMPROXY
90#include <blpapi_streamproxy.h>
91#endif
92
93#ifndef INCLUDED_BLPAPI_TYPES
94#include <blpapi_types.h>
95#endif
96
98
99#ifdef __cplusplus
100extern "C" {
101#endif
102
106
110
114
118
122
125 const blpapi_SchemaElementDefinition_t *field, size_t index);
126
127// -- NOT USED or IMPLEMENTED: removing
128// BLPAPI_EXPORT
129// size_t blpapi_SchemaElementDefinition_numNames(
130// const blpapi_SchemaElementDefinition_t *field);
131
135
139
143 blpapi_StreamWriter_t streamWriter,
144 void *userStream,
145 int level,
146 int spacesPerLevel);
147
150 blpapi_SchemaElementDefinition_t *field, void *userdata);
151
155
159
163
167
171
175
179
183
187
191
195
199
204 const char *nameString,
205 const blpapi_Name_t *name);
206
210 const blpapi_SchemaTypeDefinition_t *type, size_t index);
211
214 const blpapi_SchemaTypeDefinition_t *element,
215 blpapi_StreamWriter_t streamWriter,
216 void *userStream,
217 int level,
218 int spacesPerLevel);
219
222 blpapi_SchemaTypeDefinition_t *element, void *userdata);
223
226 const blpapi_SchemaTypeDefinition_t *element);
227
230 const blpapi_SchemaTypeDefinition_t *element);
231
232#ifdef __cplusplus
233}
234
235#ifndef INCLUDED_IOSFWD
236#include <iosfwd>
237#define INCLUDED_IOSFWD
238#endif
239
247namespace BloombergLP {
248namespace blpapi {
249
275
276class SchemaTypeDefinition;
277
328
330
331 public:
332 /*
333 * Constants used in the SchemaElementDefinition interface.
334 */
335
336 enum {
339 };
340
342
348 void setUserData(void *userData);
358 Name name() const;
364 const char *description() const;
371 int status() const;
382 size_t minValues() const;
388 size_t maxValues() const;
394 size_t numAlternateNames() const;
399 Name getAlternateName(size_t index) const;
406 void *userData() const;
420 std::ostream& print(
421 std::ostream& stream, int level = 0, int spacesPerLevel = 4) const;
436};
437
472
474
475 public:
477
483 // MANIPULATORS
484
485 void setUserData(void *userData);
494 // ACCESSORS
495
496 int datatype() const;
504 Name name() const;
509 const char *description() const;
517 int status() const;
523 size_t numElementDefinitions() const;
531 bool isComplexType() const;
537 bool isSimpleType() const;
543 bool isEnumerationType() const;
549 bool hasElementDefinition(const Name& name) const;
556 bool hasElementDefinition(const char *name) const;
570 SchemaElementDefinition getElementDefinition(const char *nameString) const;
584 const ConstantList enumeration() const;
591 void *userData() const;
605 std::ostream& print(
606 std::ostream& stream, int level = 0, int spacesPerLevel = 4) const;
619};
620
624// FREE OPERATORS
625
626std::ostream& operator<<(
627 std::ostream& stream, const SchemaElementDefinition& element);
640std::ostream& operator<<(
641 std::ostream& stream, const SchemaTypeDefinition& typeDef);
654// ============================================================================
655// INLINE FUNCTION DEFINITIONS
656// ============================================================================
657
658// -----------------------------
659// class SchemaElementDefinition
660// -----------------------------
661
664 : d_impl_p(handle)
665{
666}
667
669
671{
673}
674
675inline const char *SchemaElementDefinition::description() const
676{
678}
679
681{
683}
684
685inline const SchemaTypeDefinition
690
692{
694}
695
697{
699}
700
705
707{
708 blpapi_Name_t *alternateName
710 if (alternateName == 0) {
712 }
713 return Name(alternateName);
714}
715
717 std::ostream& stream, int level, int spacesPerLevel) const
718{
721 &stream,
722 level,
723 spacesPerLevel);
724 return stream;
725}
726
727inline std::ostream& operator<<(
728 std::ostream& stream, const SchemaElementDefinition& element)
729{
730 element.print(stream, 0, -1);
731 return stream;
732}
733
734inline void SchemaElementDefinition::setUserData(void *newUserData)
735{
736 blpapi_SchemaElementDefinition_setUserData(d_impl_p, newUserData);
737}
738
740{
742}
743
745{
746 return d_impl_p;
747}
748// --------------------------
749// class SchemaTypeDefinition
750// --------------------------
751
754 : d_impl_p(handle)
755{
756}
757
759
761{
763}
764
766{
767 return Name(blpapi_SchemaTypeDefinition_name(d_impl_p));
768}
769
770inline const char *SchemaTypeDefinition::description() const
771{
773}
774
776{
777 return blpapi_SchemaTypeDefinition_status(d_impl_p);
778}
779
784
786 const Name& elementName) const
787{
789 d_impl_p, 0, elementName.impl())
790 ? true
791 : false;
792}
793
795 const char *nameString) const
796{
798 d_impl_p, nameString, 0)
799 ? true
800 : false;
801}
802
814
816 const char *nameString) const
817{
820 d_impl_p, nameString, 0);
821 if (def == 0) {
823 }
824 return SchemaElementDefinition(def);
825}
826
838
840{
841 return blpapi_SchemaTypeDefinition_isComplexType(d_impl_p) ? true : false;
842}
843
845{
846 return blpapi_SchemaTypeDefinition_isSimpleType(d_impl_p) ? true : false;
847}
848
850{
852 : false;
853}
854
855inline std::ostream& SchemaTypeDefinition::print(
856 std::ostream& stream, int level, int spacesPerLevel) const
857{
860 &stream,
861 level,
862 spacesPerLevel);
863 return stream;
864}
865
866inline std::ostream& operator<<(
867 std::ostream& stream, const SchemaTypeDefinition& typeDef)
868{
869 typeDef.print(stream, 0, -1);
870 return stream;
871}
872
873inline void SchemaTypeDefinition::setUserData(void *newUserData)
874{
875 blpapi_SchemaTypeDefinition_setUserData(d_impl_p, newUserData);
876}
877
879{
881}
882
887
888} // close namespace blpapi
889} // close namespace BloombergLP
890
891#endif // #ifdef __cplusplus
892
893#endif // #ifndef INCLUDED_BLPAPI_SCHEMA
Provide a representation for schema-level enumeration constants.
Common definitions used by the library.
#define BLPAPI_STATUS_ACTIVE
Definition blpapi_defs.h:98
#define BLPAPI_EXPORT
Definition blpapi_defs.h:171
#define BLPAPI_ELEMENTDEFINITION_UNBOUNDED
Definition blpapi_defs.h:114
#define BLPAPI_STATUS_INACTIVE
Definition blpapi_defs.h:100
#define BLPAPI_STATUS_DEPRECATED
Definition blpapi_defs.h:99
#define BLPAPI_STATUS_PENDING_DEPRECATION
Definition blpapi_defs.h:101
#define BLPAPI_ERROR_ITEM_NOT_FOUND
Definition blpapi_error.h:78
#define BLPAPI_ERROR_INDEX_OUT_OF_RANGE
Definition blpapi_error.h:76
Defines Exceptions that can be thrown by the blpapi library.
Provide a representation of strings for use as container keys.
BLPAPI_EXPORT blpapi_Name_t * blpapi_SchemaTypeDefinition_name(const blpapi_SchemaTypeDefinition_t *type)
BLPAPI_EXPORT void blpapi_SchemaTypeDefinition_setUserData(blpapi_SchemaTypeDefinition_t *element, void *userdata)
BLPAPI_EXPORT int blpapi_SchemaTypeDefinition_isSimple(const blpapi_SchemaTypeDefinition_t *type)
BLPAPI_EXPORT int blpapi_SchemaTypeDefinition_datatype(const blpapi_SchemaTypeDefinition_t *type)
BLPAPI_EXPORT void * blpapi_SchemaElementDefinition_userData(const blpapi_SchemaElementDefinition_t *field)
BLPAPI_EXPORT int blpapi_SchemaElementDefinition_status(const blpapi_SchemaElementDefinition_t *field)
BLPAPI_EXPORT blpapi_SchemaTypeDefinition_t * blpapi_SchemaElementDefinition_type(const blpapi_SchemaElementDefinition_t *field)
BLPAPI_EXPORT blpapi_Name_t * blpapi_SchemaElementDefinition_getAlternateName(const blpapi_SchemaElementDefinition_t *field, size_t index)
BLPAPI_EXPORT size_t blpapi_SchemaElementDefinition_numAlternateNames(const blpapi_SchemaElementDefinition_t *field)
void * blpapi_SchemaTypeDefinition_t
Definition blpapi_schema.h:97
BLPAPI_EXPORT int blpapi_SchemaTypeDefinition_isSimpleType(const blpapi_SchemaTypeDefinition_t *type)
BLPAPI_EXPORT blpapi_SchemaElementDefinition_t * blpapi_SchemaTypeDefinition_getElementDefinitionAt(const blpapi_SchemaTypeDefinition_t *type, size_t index)
BLPAPI_EXPORT int blpapi_SchemaTypeDefinition_status(const blpapi_SchemaTypeDefinition_t *type)
BLPAPI_EXPORT int blpapi_SchemaTypeDefinition_print(const blpapi_SchemaTypeDefinition_t *element, blpapi_StreamWriter_t streamWriter, void *userStream, int level, int spacesPerLevel)
BLPAPI_EXPORT blpapi_SchemaElementDefinition_t * blpapi_SchemaTypeDefinition_getElementDefinition(const blpapi_SchemaTypeDefinition_t *type, const char *nameString, const blpapi_Name_t *name)
BLPAPI_EXPORT size_t blpapi_SchemaElementDefinition_minValues(const blpapi_SchemaElementDefinition_t *field)
BLPAPI_EXPORT blpapi_ConstantList_t * blpapi_SchemaTypeDefinition_enumeration(const blpapi_SchemaTypeDefinition_t *element)
BLPAPI_EXPORT void * blpapi_SchemaTypeDefinition_userData(const blpapi_SchemaTypeDefinition_t *element)
BLPAPI_EXPORT blpapi_Name_t * blpapi_SchemaElementDefinition_name(const blpapi_SchemaElementDefinition_t *field)
BLPAPI_EXPORT void blpapi_SchemaElementDefinition_setUserData(blpapi_SchemaElementDefinition_t *field, void *userdata)
BLPAPI_EXPORT int blpapi_SchemaTypeDefinition_isComplexType(const blpapi_SchemaTypeDefinition_t *type)
BLPAPI_EXPORT int blpapi_SchemaTypeDefinition_isComplex(const blpapi_SchemaTypeDefinition_t *type)
BLPAPI_EXPORT size_t blpapi_SchemaElementDefinition_maxValues(const blpapi_SchemaElementDefinition_t *field)
BLPAPI_EXPORT const char * blpapi_SchemaTypeDefinition_description(const blpapi_SchemaTypeDefinition_t *type)
BLPAPI_EXPORT int blpapi_SchemaElementDefinition_print(const blpapi_SchemaElementDefinition_t *element, blpapi_StreamWriter_t streamWriter, void *userStream, int level, int spacesPerLevel)
BLPAPI_EXPORT const char * blpapi_SchemaElementDefinition_description(const blpapi_SchemaElementDefinition_t *field)
BLPAPI_EXPORT int blpapi_SchemaTypeDefinition_isEnumerationType(const blpapi_SchemaTypeDefinition_t *type)
BLPAPI_EXPORT size_t blpapi_SchemaTypeDefinition_numElementDefinitions(const blpapi_SchemaTypeDefinition_t *type)
BLPAPI_EXPORT int blpapi_SchemaTypeDefinition_isEnumeration(const blpapi_SchemaTypeDefinition_t *type)
A signature for callback on print and default C++ implementation.
int(* blpapi_StreamWriter_t)(const char *data, int length, void *stream)
Definition blpapi_streamproxy.h:53
Provide BLPAPI types.
Definition blpapi_constant.h:396
static void throwOnError(int errorCode)
Definition blpapi_exception.h:526
Definition blpapi_name.h:150
blpapi_Name_t * impl() const
Definition blpapi_name.h:403
Definition blpapi_schema.h:327
Name name() const
Definition blpapi_schema.h:670
~SchemaElementDefinition()
Definition blpapi_schema.h:668
Name getAlternateName(size_t index) const
Definition blpapi_schema.h:706
std::ostream & print(std::ostream &stream, int level=0, int spacesPerLevel=4) const
Definition blpapi_schema.h:716
void * userData() const
Definition blpapi_schema.h:739
blpapi_SchemaElementDefinition_t * impl() const
Definition blpapi_schema.h:744
int status() const
Definition blpapi_schema.h:680
SchemaElementDefinition(blpapi_SchemaElementDefinition_t *handle)
Definition blpapi_schema.h:662
size_t numAlternateNames() const
Definition blpapi_schema.h:701
size_t maxValues() const
Definition blpapi_schema.h:696
const char * description() const
Definition blpapi_schema.h:675
size_t minValues() const
Definition blpapi_schema.h:691
@ UNBOUNDED
Indicates an array has an unbounded number of values.
Definition blpapi_schema.h:337
void setUserData(void *userData)
Definition blpapi_schema.h:734
const SchemaTypeDefinition typeDefinition() const
Definition blpapi_schema.h:686
Definition blpapi_schema.h:471
Name name() const
Definition blpapi_schema.h:765
SchemaElementDefinition getElementDefinition(const Name &name) const
Definition blpapi_schema.h:803
int datatype() const
Definition blpapi_schema.h:760
bool hasElementDefinition(const Name &name) const
Definition blpapi_schema.h:785
std::ostream & print(std::ostream &stream, int level=0, int spacesPerLevel=4) const
Definition blpapi_schema.h:855
void * userData() const
Definition blpapi_schema.h:878
size_t numElementDefinitions() const
Definition blpapi_schema.h:780
bool isComplexType() const
Definition blpapi_schema.h:839
const ConstantList enumeration() const
Definition blpapi_schema.h:883
int status() const
Definition blpapi_schema.h:775
~SchemaTypeDefinition()
Definition blpapi_schema.h:758
const char * description() const
Definition blpapi_schema.h:770
bool isSimpleType() const
Definition blpapi_schema.h:844
void setUserData(void *userData)
Definition blpapi_schema.h:873
SchemaTypeDefinition(blpapi_SchemaTypeDefinition_t *handle)
Definition blpapi_schema.h:752
bool isEnumerationType() const
Definition blpapi_schema.h:849
struct blpapi_Name blpapi_Name_t
Definition blpapi_types.h:154
struct blpapi_ConstantList blpapi_ConstantList_t
Definition blpapi_types.h:133
struct blpapi_SchemaElementDefinition blpapi_SchemaElementDefinition_t
Definition blpapi_types.h:191
std::ostream & operator<<(std::ostream &os, const CorrelationId &correlator)
Definition blpapi_correlationid.h:592
Definition blpapi_abstractsession.h:195
Definition blpapi_schema.h:257
Value
Definition blpapi_schema.h:259
@ ACTIVE
This item is current and may appear in Messages.
Definition blpapi_schema.h:260
@ INACTIVE
This item is not current and will not appear in Messages.
Definition blpapi_schema.h:267
@ DEPRECATED
Definition blpapi_schema.h:263
@ PENDING_DEPRECATION
Definition blpapi_schema.h:270
static int writeToStream(const char *data, int length, void *stream)
Definition blpapi_streamproxy.h:93