Plugins/PointSprite/ParaViewPlugin/Qvis/AttributeGroup.cpp
void
AttributeGroup::CreateTypeMap(const char *formatString)
{
    // Clear the typeMap.
    typeMap.clear();

    // If the format string is NULL, return.
    if(formatString == NULL)
        return;

    // If the formatString was empty, get out of here.
    int nDeclares = static_cast<int>(strlen(formatString));
    if(nDeclares < 1)
        return;

    // Go through the format string and add the types.
    typeMap.reserve(nDeclares);
    for(int i = 0; i < nDeclares; ++i)
    {
        char baseFormat = formatString[i];

        // If the next character is a '*' then it is a vector.
        bool isVector = (i < nDeclares - 1) ? (formatString[i + 1] == '*') :
                        false;

        if(isVector)
        {
            // Advance one character
            ++i;

            // Declare vectors
            switch(baseFormat)
            {
            case 'b':
                DeclareVectorBool();
                break;
            case 'c':
                DeclareVectorChar();
                break;
            case 'u':
                DeclareVectorUnsignedChar();
                break;
            case 'i':
                DeclareVectorInt();
                break;
            case 'l':
                DeclareVectorLong();
                break;
            case 'f':
                DeclareVectorFloat();
                break;
            case 'd':
                DeclareVectorDouble();
                break;
            case 's':
                DeclareVectorString();
                break;
            case 'a':
                DeclareVectorAttributeGroup();
                break;
            default:
                EXCEPTION0(BadDeclareFormatString);
            }
        }
        else
        {
            // Declare simple types, fixed length, attributegroups
            switch(baseFormat)
            {
            case 'c':
                DeclareChar();
                break;
            case 'u':
                DeclareUnsignedChar();
                break;
            case 'i':
                DeclareInt();
                break;
            case 'l':
                DeclareLong();
                break;
            case 'f':
                DeclareFloat();
                break;
            case 'd':
                DeclareDouble();
                break;
            case 's':
                DeclareString();
                break;
            case 'a':
                DeclareAttributeGroup();
                break;
            case 'b':
                DeclareBool();
                break;
            case 'C':
                DeclareListChar();
                break;
            case 'U':
                DeclareListUnsignedChar();
                break;
            case 'I':
                DeclareListInt();
                break;
            case 'L':
                DeclareListLong();
                break;
            case 'F':
                DeclareListFloat();
                break;
            case 'D':
                DeclareListDouble();
                break;
            case 'S':
                DeclareListString();
                break;
            case 'A':
                DeclareListAttributeGroup();
                break;
            case 'B':
                DeclareListBool();
                break;
            default:
                EXCEPTION0(BadDeclareFormatString);
            }
        }
    }
}
// ****************************************************************************
// Method: AttributeGroup::CreateTypeMap
//
// Purpose:
//   This is a convenience function that takes a format string and
//   adds the appropriate types to the type map.
//
// Arguments:
//   formatString : A string where each character represents the type
//                  of an attribute in the AttributeGroup.
//
// Programmer: Brad Whitlock
// Creation:   Fri Aug 4 17:15:29 PST 2000
//
// Modifications:
//   Brad Whitlock, Tue Aug 29 10:30:02 PDT 2000
//   I changed it so an empty or NULL format string is allowable.
//
//   Hank Childs, Fri Jan 28 15:36:03 PST 2005
//   Use exception macros.
//
// ****************************************************************************
:CreateTypeMap
Purpose:
This is a convenience function that takes a format string and
adds the appropriate types to the type map.

formatString : A string where each character represents the type
of an attribute in the AttributeGroup.

Brad Whitlock
Creation:   Fri Aug 4 17:15:29 PST 2000

Brad Whitlock, Tue Aug 29 10:30:02 PDT 2000
I changed it so an empty or NULL format string is allowable.

Hank Childs, Fri Jan 28 15:36:03 PST 2005
Use exception macros.
: CreateTypeMap Purpose : This is a convenience function that takes a format string and adds the appropriate types to the type map . formatString : A string where each character represents the type of an attribute in the AttributeGroup . Brad Whitlock Creation : Fri Aug 4 17 : 15 : 29 PST 2000 Brad Whitlock Tue Aug 29 10 : 30 : 02 PDT 2000 I changed it so an empty or NULL format string is allowable . Hank Childs Fri Jan 28 15 : 36 : 03 PST 2005 Use exception macros .
void
AttributeGroup::CreateTypeMap(const char *formatString)
{
    typeMap.clear();
    if(formatString == NULL)
        return;
    int nDeclares = static_cast<int>(strlen(formatString));
    if(nDeclares < 1)
        return;
    typeMap.reserve(nDeclares);
    for(int i = 0; i < nDeclares; ++i)
    {
        char baseFormat = formatString[i];
        bool isVector = (i < nDeclares - 1) ? (formatString[i + 1] == '*') :
                        false;
        if(isVector)
        {
            ++i;
            switch(baseFormat)
            {
            case 'b':
                DeclareVectorBool();
                break;
            case 'c':
                DeclareVectorChar();
                break;
            case 'u':
                DeclareVectorUnsignedChar();
                break;
            case 'i':
                DeclareVectorInt();
                break;
            case 'l':
                DeclareVectorLong();
                break;
            case 'f':
                DeclareVectorFloat();
                break;
            case 'd':
                DeclareVectorDouble();
                break;
            case 's':
                DeclareVectorString();
                break;
            case 'a':
                DeclareVectorAttributeGroup();
                break;
            default:
                EXCEPTION0(BadDeclareFormatString);
            }
        }
        else
        {
            switch(baseFormat)
            {
            case 'c':
                DeclareChar();
                break;
            case 'u':
                DeclareUnsignedChar();
                break;
            case 'i':
                DeclareInt();
                break;
            case 'l':
                DeclareLong();
                break;
            case 'f':
                DeclareFloat();
                break;
            case 'd':
                DeclareDouble();
                break;
            case 's':
                DeclareString();
                break;
            case 'a':
                DeclareAttributeGroup();
                break;
            case 'b':
                DeclareBool();
                break;
            case 'C':
                DeclareListChar();
                break;
            case 'U':
                DeclareListUnsignedChar();
                break;
            case 'I':
                DeclareListInt();
                break;
            case 'L':
                DeclareListLong();
                break;
            case 'F':
                DeclareListFloat();
                break;
            case 'D':
                DeclareListDouble();
                break;
            case 'S':
                DeclareListString();
                break;
            case 'A':
                DeclareListAttributeGroup();
                break;
            case 'B':
                DeclareListBool();
                break;
            default:
                EXCEPTION0(BadDeclareFormatString);
            }
        }
    }
}
void AttributeGroup :: CreateTypeMap ( const char * formatString ) { typeMap . clear ( ) ; if ( formatString == NULL ) return ; int nDeclares = static_cast < int > ( strlen ( formatString ) ) ; if ( nDeclares < 1 ) return ; typeMap . reserve ( nDeclares ) ; for ( int i = 0 ; i < nDeclares ; ++ i ) { char baseFormat = formatString [ i ] ; bool isVector = ( i < nDeclares - 1 ) ? ( formatString [ i + 1 ] == ' ' ) : false ; if ( isVector ) { ++ i ; switch ( baseFormat ) { case ' ' : DeclareVectorBool ( ) ; break ; case ' ' : DeclareVectorChar ( ) ; break ; case ' ' : DeclareVectorUnsignedChar ( ) ; break ; case ' ' : DeclareVectorInt ( ) ; break ; case ' ' : DeclareVectorLong ( ) ; break ; case ' ' : DeclareVectorFloat ( ) ; break ; case ' ' : DeclareVectorDouble ( ) ; break ; case ' ' : DeclareVectorString ( ) ; break ; case ' ' : DeclareVectorAttributeGroup ( ) ; break ; default : EXCEPTION0 ( BadDeclareFormatString ) ; } } else { switch ( baseFormat ) { case ' ' : DeclareChar ( ) ; break ; case ' ' : DeclareUnsignedChar ( ) ; break ; case ' ' : DeclareInt ( ) ; break ; case ' ' : DeclareLong ( ) ; break ; case ' ' : DeclareFloat ( ) ; break ; case ' ' : DeclareDouble ( ) ; break ; case ' ' : DeclareString ( ) ; break ; case ' ' : DeclareAttributeGroup ( ) ; break ; case ' ' : DeclareBool ( ) ; break ; case ' ' : DeclareListChar ( ) ; break ; case ' ' : DeclareListUnsignedChar ( ) ; break ; case ' ' : DeclareListInt ( ) ; break ; case ' ' : DeclareListLong ( ) ; break ; case ' ' : DeclareListFloat ( ) ; break ; case ' ' : DeclareListDouble ( ) ; break ; case ' ' : DeclareListString ( ) ; break ; case ' ' : DeclareListAttributeGroup ( ) ; break ; case ' ' : DeclareListBool ( ) ; break ; default : EXCEPTION0 ( BadDeclareFormatString ) ; } } } }
Method: AttributeGroup::CreateTypeMap
Purpose:
This is a convenience function that takes a format string and
adds the appropriate types to the type map.
Method : AttributeGroup :: CreateTypeMap Purpose : This is a convenience function that takes a format string and adds the appropriate types to the type map .
// Clear the typeMap. // If the format string is NULL, return. // If the formatString was empty, get out of here. // Go through the format string and add the types. // If the next character is a '*' then it is a vector. // Advance one character // Declare vectors // Declare simple types, fixed length, attributegroups