This file is indexed.

/usr/include/camitk-4.0/libraries/pml/MultiComponent.h is in libcamitk-dev 4.0.4-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*****************************************************************************
 * $CAMITK_LICENCE_BEGIN$
 *
 * CamiTK - Computer Assisted Medical Intervention ToolKit
 * (c) 2001-2016 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
 *
 * Visit http://camitk.imag.fr for more information
 *
 * This file is part of CamiTK.
 *
 * CamiTK is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * CamiTK is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with CamiTK.  If not, see <http://www.gnu.org/licenses/>.
 *
 * $CAMITK_LICENCE_END$
 ****************************************************************************/

#ifndef MULTICOMPONENT_H
#define MULTICOMPONENT_H

#include <vector>
#include <algorithm>

#include "Component.h"
/**
  * @ingroup group_cepmodeling_libraries_pml
  *
  * @brief
  * A multi-component stores other components, hence providing a way to have
  * an tree representation of components. Isn't that tricky?
  *
  * \note To delete and free the memory of all the sub components, you have to
  * call the deleteAllSubComponents() method.
  *
 **/
class MultiComponent : public Component {
public:
    /** Default Constructor */
    MultiComponent(PhysicalModel *);
    /// constructor that allows one to name the structure (provides a name)
    MultiComponent(PhysicalModel *, std::string);
    /// delete all the subcomponents (call the deleteAllSubComponents method)
    ~MultiComponent();

    /// return the number of subcomponents
    unsigned int getNumberOfSubComponents() const;

    /// get a subcomponent by its order number (index in the list of subcomponents)
    Component * getSubComponent(const unsigned int) const;

    /// add a component in the list of subcomponents (and set the isExclusive flag accordingly to the state of this MultiComponent)
    void addSubComponent(Component *);

    /**
     * Remove a component from the list.
     * Becareful: this method DOES NOT delete the object and/or free the memory.
      * This method ask the component c to remove this multicomponent from the list of its parent component
     * @param c the ptr to the structure to remove
     * @see removeAllSubComponent()
     */
    void removeSubComponent(Component *c);

    /**
     * this method free all the sub-components (i.e. delete all the sub component
     *  and clear the list).
     * After this methode getNumberOfSubComponents should return 0
     */
    void deleteAllSubComponents();

    /** return true only if the parameter is equal to "MultiComponent" */
    virtual bool isInstanceOf(const char *) const;

    /** print to an output stream in "pseaudo" XML format (do nothing if there are no sub components).
      */
    void xmlPrint(std::ostream &) const;

    /// get the total nr of cell of the component
    unsigned int getNumberOfCells() const;

    /// get cell by order number (not cell index)
    Cell * getCell(unsigned int) const;

    /// conveniant method to get the sub component of the name given in parameter
    Component * getComponentByName(const std::string);

    /// return the state of a visibility mode in all the sub component (if at least one sub component is visible for this mode, it will return true; if none are visible it will return false).
    virtual bool isVisible(const RenderingMode::Mode mode) const;

    /// set the state of a visibility mode in all the sub component.
    virtual void setVisible(const RenderingMode::Mode mode, const bool b);

    /// set the physical model (recursively)
    virtual void setPhysicalModel(PhysicalModel *);

protected:
    /**
     * List of sub component
     */
    std::vector <Component *> components;
};

// -------------------- inline methods -------------------
inline unsigned int MultiComponent::getNumberOfSubComponents() const {
    return (unsigned int) components.size();
}
inline Component * MultiComponent::getSubComponent(const unsigned int i) const {
    if (i<components.size())
        return components[i];
    else
        return NULL;
}
inline void MultiComponent::addSubComponent(Component * c) {
    // add c in the list
    components.push_back(c);
    // add this in the list of c's composing component
    c->addParentMultiComponent(this);
    // set the isExclusive flag accordingly
    c->setExclusive(isExclusive());
}
inline void MultiComponent::removeSubComponent(Component *c) {
    std::vector <Component *>::iterator it = std::find(components.begin(), components.end(), c);
    if (it != components.end()) {
        components.erase(it);
        c->removeParentMultiComponent(this);
    }
}
inline Component * MultiComponent::getComponentByName(const std::string n) {
    std::vector <Component *>::iterator it=components.begin();
    Component *foundC=NULL;
    while (it!=components.end() && !foundC) {
        foundC = ((*it)->getName()==n)?(*it):NULL;
        // look inside the component if it is a MultiComponent
        if (!foundC && (*it)->isInstanceOf("MultiComponent")) {
            foundC = ((MultiComponent *) (*it))->getComponentByName(n);
        }
        it++;
    }
    return foundC;
}
inline bool MultiComponent::isInstanceOf(const char *className) const {
    return (std::string(className)==std::string("MultiComponent"));
}

#endif //MULTICOMPONENT_H