本文整理汇总了C++中ComplexType类的典型用法代码示例。如果您正苦于以下问题:C++ ComplexType类的具体用法?C++ ComplexType怎么用?C++ ComplexType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ComplexType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TypeContainer
TypeContainer*
TypeContainer::getAttributeContainer(std::string elemName,
bool create)
{
TypeContainer *container = 0;
if ((container = attributeContainers_[elemName]) != 0)
return container;
if (!create)
return container;
/*
Create and return a Type Container
*/
const XSDType *pType = sParser_->getType(typeId_);
if (pType != 0 && !pType->isSimple())
{
ComplexType *cType = (ComplexType *) pType;
for (int i = 0; i < cType->getNumAttributes(); i++)
{
if (cType->getAttributeName(i) == elemName)
{
container =
new TypeContainer(cType->getAttributeType(i), sParser_);
tcTable.push_back(container);
break;
}
}
}
attributeContainers_[elemName] = container;
return container;
}
示例2: parseCompositor
void Parser::parseCompositor( ParserContext *context,
const QDomElement &element, ComplexType &ct )
{
QName name = element.tagName();
bool isChoice = name.localName() == "choice";
bool isSequence = name.localName() == "sequence";
Compositor compositor;
if ( isChoice ) compositor.setType( Compositor::Choice );
else if ( isSequence ) compositor.setType( Compositor::Sequence );
if ( isChoice || isSequence ) {
Element::List newElements;
QDomElement childElement = element.firstChildElement();
while ( !childElement.isNull() ) {
QName csName = childElement.tagName();
if ( csName.localName() == "element" ) {
Element newElement;
if ( isChoice ) {
newElement = parseElement( context, childElement,
ct.nameSpace(), element );
} else {
if ( isSequence ) {
// occurence attributes can be either in the
// parent (sequence) to on the current element
if ( childElement.hasAttribute("minOccurs") ||
childElement.hasAttribute("maxOccurs")) {
newElement = parseElement( context, childElement,
ct.nameSpace(), childElement );
} else {
newElement = parseElement( context, childElement,
ct.nameSpace(), element );
}
} else {
newElement = parseElement( context, childElement,
ct.nameSpace(), childElement );
}
}
newElements.append( newElement );
compositor.addChild( csName );
} else if ( csName.localName() == "any" ) {
addAny( context, childElement, ct );
} else if ( isChoice ) {
parseCompositor( context, childElement, ct );
} else if ( isSequence ) {
parseCompositor( context, childElement, ct );
}
childElement = childElement.nextSiblingElement();
}
foreach( Element e, newElements ) {
e.setCompositor( compositor );
ct.addElement( e );
}
示例3: temp
void MapEncoder::addKeyDate( UInt16 year, UInt8 month, UInt8 day, MapEntry::MapAction action,
const ComplexType& value, const EmaBuffer& permissionData )
{
RsslDate date;
date.year = year;
date.month = month;
date.day = day;
if ( RSSL_FALSE == rsslDateIsValid( &date ) )
{
EmaString temp( "Attempt to specify invalid date. Passed in value is='" );
temp.append( (UInt32)month ).append( " / " ).
append( (UInt32)day ).append( " / " ).
append( (UInt32)year ).append( "'." );
throwOorException( temp );
return;
}
const Encoder& enc = value.getEncoder();
UInt8 rsslDataType = enc.convertDataType( value.getDataType() );
validateEntryKeyAndPayLoad(RSSL_DT_DATE, rsslDataType, value.getDataType(), "addKeyDate()");
if ( action == MapEntry::DeleteEnum )
{
addEntryWithNoPayload( &date, action, permissionData, "addKeyDate()" );
}
else if ( value.hasEncoder() && enc.ownsIterator() )
{
if ( enc.isComplete() )
addEncodedEntry( &date, action, value, permissionData, "addKeyDate()" );
else
{
EmaString temp( "Attempt to add a ComplexType while complete() was not called on this ComplexType." );
throwIueException( temp );
return;
}
}
else if ( value.hasDecoder() )
{
addDecodedEntry( &date, action, value, permissionData, "addKeyDate()" );
}
else
{
if ( rsslDataType == RSSL_DT_MSG )
{
EmaString temp( "Attempt to pass in an empty message while it is not supported." );
throwIueException( temp );
return;
}
passEncIterator( const_cast<Encoder&>( enc ) );
startEncodingEntry( &date, action, permissionData, "addKeyDate()" );
}
}
示例4: resolveForwardElementRefs
void TypesTable::resolveForwardElementRefs(const QString &name, Element &element)
{
for(int i = 0; i < (int)mTypes.count(); i++)
if(mTypes[i] != 0)
{
if(!mTypes[i]->isSimple())
{
ComplexType *ct = (ComplexType *)mTypes[i];
ct->matchElementRef(name, element);
}
}
}
示例5: resolveForwardAttributeRefs
void TypesTable::resolveForwardAttributeRefs(const QString &name, Attribute &attribute)
{
for(int i = 0; i < (int)mTypes.count(); i++)
if(mTypes[i] != 0)
{
if(!mTypes[i]->isSimple())
{
ComplexType *ct = (ComplexType *)mTypes[i];
ct->matchAttributeRef(name, attribute);
}
}
}
示例6: set
/// set an element
/// @param i :: The element index
/// @param value :: The new value
void ComplexVector::set(size_t i, const ComplexType &value) {
if (i < m_vector->size) {
gsl_vector_complex_set(m_vector, i,
gsl_complex{{value.real(), value.imag()}});
} else {
std::stringstream errmsg;
errmsg << "ComplexVector index = " << i
<< " is out of range = " << m_vector->size
<< " in ComplexVector.set()";
throw std::out_of_range(errmsg.str());
}
}
示例7: validateEntryKeyAndPayLoad
void MapEncoder::addKeyRealFromDouble( double key, MapEntry::MapAction action,
const ComplexType& value, OmmReal::MagnitudeType magnitudeType, const EmaBuffer& permissionData )
{
const Encoder& enc = value.getEncoder();
UInt8 rsslDataType = enc.convertDataType( value.getDataType() );
validateEntryKeyAndPayLoad(RSSL_DT_REAL, rsslDataType, value.getDataType(), "addKeyRealFromDouble()");
RsslReal real;
if ( RSSL_RET_SUCCESS != rsslDoubleToReal( &real, &key, magnitudeType ) )
{
EmaString temp( "Attempt to addKeyRealFromDouble() with invalid magnitudeType='" );
temp.append( getMTypeAsString( magnitudeType) ).append( "'. " );
throwIueException( temp );
return;
}
if ( action == MapEntry::DeleteEnum )
{
addEntryWithNoPayload( &real, action, permissionData, "addKeyRealFromDouble()" );
}
else if ( value.hasEncoder() && enc.ownsIterator() )
{
if ( enc.isComplete() )
addEncodedEntry( &real, action, value, permissionData, "addKeyRealFromDouble()" );
else
{
EmaString temp( "Attempt to add a ComplexType while complete() was not called on this ComplexType." );
throwIueException( temp );
return;
}
}
else if ( value.hasDecoder() )
{
addDecodedEntry( &real, action, value, permissionData, "addKeyRealFromDouble()" );
}
else
{
if ( rsslDataType == RSSL_DT_MSG )
{
EmaString temp( "Attempt to pass in an empty message while it is not supported." );
throwIueException( temp );
return;
}
passEncIterator( const_cast<Encoder&>( enc ) );
startEncodingEntry( &real, action, permissionData, "addKeyRealFromDouble()" );
}
}
示例8: addVariableValue
void NetPlace::addVariableValue(const QString &name, Type * type)
{
if (type->type() == complex)
{
ComplexType * complexType = reinterpret_cast<ComplexType *>(type);
foreach (QString variable, complexType->variables().keys())
addVariableValue(name + "." + variable, complexType->variables()[variable]);
}
else
{
SimpleType * simpleType = reinterpret_cast<SimpleType *>(type);
m_values.insert(name, simpleType->values());
m_types.insert(name, simpleType->values().count() > 1 ? array : variable);
}
}
示例9: addEncodedEntry
void MapEncoder::addEncodedEntry( void* keyValue, MapEntry::MapAction action,
const ComplexType& value, const EmaBuffer& permission, const char* methodName )
{
rsslClearMapEntry(&_rsslMapEntry);
_rsslMapEntry.encData = value.getEncoder().getRsslBuffer();
_rsslMapEntry.action = action;
encodePermissionData( permission );
RsslRet retCode = rsslEncodeMapEntry( &_pEncodeIter->_rsslEncIter, &_rsslMapEntry, keyValue );
while ( retCode == RSSL_RET_BUFFER_TOO_SMALL )
{
_pEncodeIter->reallocate();
retCode = rsslEncodeMapEntry( &_pEncodeIter->_rsslEncIter, &_rsslMapEntry, keyValue );
}
if ( retCode < RSSL_RET_SUCCESS )
{
EmaString temp( "Failed to " );
temp.append( methodName ).append( " while encoding Map. Reason='" );
temp.append( rsslRetCodeToString( retCode ) ).append( "'. " );
throwIueException( temp );
}
}
示例10: parseCompositor
void Parser::parseCompositor( ParserContext *context,
const QDomElement &element, ComplexType &ct )
{
const QName name( element.tagName() );
bool isChoice = name.localName() == QLatin1String("choice");
bool isSequence = name.localName() == QLatin1String("sequence");
Compositor compositor;
if ( isChoice ) compositor.setType( Compositor::Choice );
else if ( isSequence ) compositor.setType( Compositor::Sequence );
compositor.setMaxOccurs( readMaxOccurs( element ) );
if ( isChoice || isSequence ) {
Element::List newElements;
QDomElement childElement = element.firstChildElement();
while ( !childElement.isNull() ) {
NSManager namespaceManager( context, childElement );
const QName csName( childElement.tagName() );
if ( csName.localName() == QLatin1String("element") ) {
Element newElement;
if ( isChoice ) {
newElement = parseElement( context, childElement,
ct.nameSpace(), element );
} else {
newElement = parseElement( context, childElement,
ct.nameSpace(), childElement );
}
newElements.append( newElement );
compositor.addChild( csName );
} else if ( csName.localName() == QLatin1String("any") ) {
addAny( context, childElement, ct );
} else if ( isChoice ) {
parseCompositor( context, childElement, ct );
} else if ( isSequence ) {
parseCompositor( context, childElement, ct );
}
childElement = childElement.nextSiblingElement();
}
foreach( Element e, newElements ) {
e.setCompositor( compositor );
ct.addElement( e );
}
示例11: all
void Parser::all( ParserContext *context, const QDomElement &element, ComplexType &ct )
{
QDomElement childElement = element.firstChildElement();
while ( !childElement.isNull() ) {
QName name = childElement.tagName();
if ( name.localName() == "element" ) {
ct.addElement( parseElement( context, childElement, ct.nameSpace(),
childElement ) );
} else if ( name.localName() == "annotation" ) {
Annotation::List annotations = parseAnnotation( context, childElement );
ct.setDocumentation( annotations.documentation() );
ct.setAnnotations( annotations );
}
childElement = childElement.nextSiblingElement();
}
}
示例12: rsslMapApplyHasSummaryData
void MapEncoder::summaryData( const ComplexType& data )
{
if ( !_containerInitialized )
{
const Encoder& enc = data.getEncoder();
if ( data.hasEncoder() && enc.ownsIterator() )
{
if ( enc.isComplete() )
{
rsslMapApplyHasSummaryData( &_rsslMap );
_rsslMap.encSummaryData = enc.getRsslBuffer();
}
else
{
EmaString temp( "Attempt to set summaryData() with a ComplexType while complete() was not called on this ComplexType." );
throwIueException( temp );
return;
}
}
else if ( data.hasDecoder() )
{
rsslMapApplyHasSummaryData( &_rsslMap );
_rsslMap.encSummaryData = const_cast<ComplexType&>(data).getDecoder().getRsslBuffer();
}
else
{
EmaString temp( "Attempt to pass an empty ComplexType to summaryData() while it is not supported." );
throwIueException( temp );
return;
}
_emaLoadType = data.getDataType();
_rsslMap.containerType = enc.convertDataType( _emaLoadType );
}
else
{
EmaString temp( "Invalid attempt to call summaryData() when container is not empty." );
throwIueException( temp );
}
}
示例13: fs
bool LexiconEntry<T>::fromFile(const string &filename)
{ // this does not use boost serialization
ifstream fs(filename.c_str());
if(!fs.good())
return false;
while(fs.good())
{
string line;
getline(fs, line);
if(line.size())
{
ComplexType ct;
if(!ct.fromString(line))
{
cerr << "Error while parsing the complex type \""<<line<<"\""<<endl;
return false;
}
(*this)[ct] = 1.0;
}
}
normalize();
}
示例14: acquireEncIterator
void AckMsgEncoder::attrib( const ComplexType& attrib )
{
acquireEncIterator();
_rsslAckMsg.msgBase.msgKey.attribContainerType = convertDataType( attrib.getDataType() );
#ifdef __EMA_COPY_ON_SET__
if ( attrib.hasEncoder() && attrib.getEncoder().ownsIterator() )
{
const RsslBuffer& rsslBuf = attrib.getEncoder().getRsslBuffer();
_attrib.setFrom( rsslBuf.data, rsslBuf.length );
}
else if ( attrib.hasDecoder() )
{
const RsslBuffer& rsslBuf = const_cast<ComplexType&>( attrib ).getDecoder().getRsslBuffer();
_attrib.setFrom( rsslBuf.data, rsslBuf.length );
}
else
{
EmaString temp( "Attempt to pass in an empty ComplexType while it is not supported." );
throwIueException( temp );
return;
}
_rsslAckMsg.msgBase.msgKey.encAttrib.data = ( char* )_attrib.c_buf();
_rsslAckMsg.msgBase.msgKey.encAttrib.length = _attrib.length();
#else
if ( attrib.hasEncoder() && attrib.getEncoder().ownsIterator() )
_rsslAckMsg.msgBase.msgKey.encAttrib = attrib.getEncoder().getRsslBuffer();
else if ( attrib.hasDecoder() )
_rsslAckMsg.msgBase.msgKey.encAttrib = const_cast<ComplexType&>( attrib ).getDecoder().getRsslBuffer();
else
{
EmaString temp( "Attempt to pass in an empty ComplexType while it is not supported." );
throwIueException( temp );
return;
}
#endif
_rsslAckMsg.msgBase.msgKey.flags |= RSSL_MKF_HAS_ATTRIB;
_rsslAckMsg.flags |= RSSL_AKMF_HAS_MSG_KEY;
}
示例15: temp
void SeriesEncoder::add( const ComplexType& complexType )
{
if ( _containerComplete )
{
EmaString temp( "Attempt to add an entry after complete() was called." );
throwIueException( temp );
return;
}
const Encoder& enc = complexType.getEncoder();
UInt8 rsslDataType = enc.convertDataType( complexType.getDataType() );
if ( !hasEncIterator() )
{
acquireEncIterator();
initEncode( rsslDataType, complexType.getDataType() );
}
else if ( _rsslSeries.containerType != rsslDataType )
{
EmaString temp( "Attempt to add an entry with a different DataType. Passed in ComplexType has DataType of " );
temp += DataType( complexType.getDataType() ).toString();
temp += EmaString( " while the expected DataType is " );
temp += DataType( _emaDataType );
throwIueException( temp );
return;
}
if ( complexType.hasEncoder() && enc.ownsIterator() )
{
if ( enc.isComplete() )
addEncodedEntry( "add()", enc.getRsslBuffer() );
else
{
EmaString temp( "Attempt to add() a ComplexType while complete() was not called on this ComplexType." );
throwIueException( temp );
return;
}
}
else if ( complexType.hasDecoder() )
{
addEncodedEntry( "add()", const_cast<ComplexType&>( complexType ).getDecoder().getRsslBuffer() );
}
else
{
if ( rsslDataType == RSSL_DT_MSG )
{
EmaString temp( "Attempt to pass in an empty message while it is not supported." );
throwIueException( temp );
return;
}
passEncIterator( const_cast<Encoder&>( enc ) );
startEncodingEntry( "add()" );
}
}