File: ExpressionList.code

package info (click to toggle)
paraview 4.1.0%2Bdfsg%2B1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 278,136 kB
  • ctags: 340,527
  • sloc: cpp: 2,314,053; ansic: 817,139; python: 245,770; xml: 68,996; tcl: 48,285; fortran: 39,116; yacc: 5,713; java: 3,827; perl: 3,108; sh: 2,045; lex: 1,809; makefile: 935; asm: 471; pascal: 228
file content (110 lines) | stat: -rw-r--r-- 3,096 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
Function: operator[]
Declaration: Expression *operator[](const char *);
Definition:
// Modifications:
//   Brad Whitlock, Thu Aug 28 15:29:59 PST 2003
//   Simplified and removed dynamic_cast so it works on Windows.
//
Expression*
ExpressionList::operator[](const char *varname)
{   
    // Check to see if there is an expression of this name.
    std::string var(varname);
    for (int i = 0; i < GetNumExpressions(); ++i)
    {
        Expression *e = (Expression*)expressions[i];
        if (e->GetName() == var)
            return e;
    }

    return 0;
}

Function: CreateNode
Declaration: virtual bool CreateNode(DataNode *parentNode, bool completeSave, bool forceAdd);
Definition:
// ****************************************************************************
// Method: ExpressionList::CreateNode
//
// Purpose: 
//   This method creates a DataNode representation of the object so it can be saved to a config file.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   Thu Dec 18 11:24:07 PDT 2003
//
// Modifications:
//   Brad Whitlock, Fri Dec 14 16:04:18 PST 2007
//   Made it use ids.
//
// ****************************************************************************

bool
ExpressionList::CreateNode(DataNode *parentNode, bool completeSave, bool forceAdd)
{
    if(parentNode == 0)
        return false;

    ExpressionList defaultObject;
    bool addToParent = false;
    // Create a node for ExpressionList.
    DataNode *node = new DataNode("ExpressionList");

    if(completeSave || !FieldsEqual(ID_expressions, &defaultObject))
    {
        for(size_t i = 0; i < expressions.size(); ++i)
        {
            Expression *expr = (Expression *)expressions[i];
            if(!expr->GetFromDB())
            {
                addToParent = true;
                expr->CreateNode(node, completeSave, true);
            }
        }
    }

    // Add the node to the parent node.
    if(addToParent || forceAdd)
        parentNode->AddNode(node);
    else
        delete node;

    return (addToParent || forceAdd);
}

Function: GetAllVarNames
Declaration: const stringVector GetAllVarNames(const std::string &dbN) const;
Definition:
// ****************************************************************************
// Method: ExpressionList::GetAllVarNames
//
// Purpose: 
//   This method retrieves all the expression var names defined for the
//   passed database name.
//
// Arguments:
//   dbN       The database name for which to return var names.
//
// Returns:
//   A list of expression var names defined for the given database.
//
// Programmer: Kathleen Bonnell 
// Creation:   August 25, 2004 
//
// Modifications:
//   
// ****************************************************************************

const stringVector
ExpressionList::GetAllVarNames(const std::string &dbN) const
{
    stringVector vars;
    for (int i = 0; i < GetNumExpressions(); i++)
    {
        Expression *e = (Expression*)expressions[i];
        if (!e->GetHidden() && e->GetDbName() == dbN)
            vars.push_back(e->GetName());
    }
    return vars;
}