<commit_before>/*---------------------------------------------------------------------------*\
 *                                OpenSG                                     *
 *                                                                           *
 *                                                                           *
 *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
 *                                                                           *
 *                            www.opensg.org                                 *
 *                                                                           *
 *   contact: <EMAIL>, <EMAIL>, <EMAIL>          *
 *                                                                           *
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
 *                                License                                    *
 *                                                                           *
 * This library is free software; you can redistribute it and/or modify it   *
 * under the terms of the GNU Library General Public License as published    *
 * by the Free Software Foundation, version 2.                               *
 *                                                                           *
 * This library 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         *
 * Library General Public License for more details.                          *
 *                                                                           *
 * You should have received a copy of the GNU Library General Public         *
 * License along with this library; if not, write to the Free Software       *
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
 *                                                                           *
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
 *                                Changes                                    *
 *                                                                           *
 *                                                                           *
 *                                                                           *
 *                                                                           *
 *                                                                           *
 *                                                                           *
\*---------------------------------------------------------------------------*/


#ifndef _OSGSTATCOLLECTOR_H_
#define _OSGSTATCOLLECTOR_H_
#ifdef __sgi
#pragma once
#endif

#include "OSGConfig.h"
#include "OSGSystemDef.h"

#include "OSGBaseTypes.h"
#include "OSGFieldTraits.h"
#include "OSGDataType.h"

#include "OSGSField.h"

#include "OSGStatElemDesc.h"
#include "OSGMemoryObject.h"

OSG_BEGIN_NAMESPACE

class StatElem;
class StatElemDescBase;

/*! \brief Manager for Stat elements, see \guide(Statistics) for details.
*/
class OSG_SYSTEM_DLLMAPPING StatCollector : public MemoryObject
{

    /*==========================  PUBLIC  =================================*/

  public:

    typedef MemoryObject Inherited;

    /*---------------------------------------------------------------------*/
    /*! \name                     Instance                                 */
    /*! \{                                                                 */

    UInt32 getNumOfElems(void        ) const;
    void   refitElemNum (void        );
    void   clearElems   (void        );
    bool   isValidID    (Int32 elemId) const;
    void   reset        (StatElemDescBase::ResetMode mode =
                                StatElemDescBase::RESET_DRAW);

    /*! \}                                                                 */
    /*---------------------------------------------------------------------*/
    /*! \name                  Constructor                                 */
    /*! \{                                                                 */

    StatElem *getElem(Int32             elemId       ) const;

    StatElem *getElem(Int32             elemId,
                      bool              create = true);

    StatElem *getElem(StatElemDescBase &desc,
                      bool              create = true);

    template <class T>
    T        *getElem(StatElemDesc<T>  &desc,
                      bool              create = true);

    /*! \}                                                                 */
    /*---------------------------------------------------------------------*/
    /*! \name                  Constructor                                 */
    /*! \{                                                                 */

    void putToString   (      std::string  &outVal) const;
    bool getFromCString(const Char8       *&inVal );
    bool getValue      (      std::string  &name,
                              Real64       &val   );

    /*! \}                                                                 */
    /*---------------------------------------------------------------------*/
    /*! \name                  Constructor                                 */
    /*! \{                                                                 */

    StatCollector(void);
    StatCollector(const StatCollector &source);

    const StatCollector& operator =(const StatCollector &source);

    /*! \}                                                                 */
    /*---------------------------------------------------------------------*/
    /*! \name                    Create                                    */
    /*! \{                                                                 */

    static StatCollector *create(void);

    /*! \}                                                                 */
    /*---------------------------------------------------------------------*/
    /*! \name                  Comparison                                  */
    /*! \{                                                                 */

    bool operator == (const StatCollector &rhs  ) const;
    bool operator <  (const StatCollector &other) const;

    /*! \}                                                                 */
    /*---------------------------------------------------------------------*/
    /*! \name                     Operators                                */
    /*! \{                                                                 */

    StatCollector  operator +  (const StatCollector &other);
    StatCollector &operator += (const StatCollector &other);

    /*! \}                                                                 */
    /*=========================  PROTECTED  ===============================*/

  protected:

    /*! \}                                                                 */
    /*---------------------------------------------------------------------*/
    /*! \name                   Destructor                                 */
    /*! \{                                                                 */

    virtual ~StatCollector(void);

    /*! \}                                                                 */
    /*==========================  PRIVATE  ================================*/

  private:

    typedef std::vector<StatElem*>        StatElemStore;
    typedef StatElemStore::iterator       StatElemStoreIt;
    typedef StatElemStore::const_iterator StatElemStoreConstIt;

    StatElemStore _elemVec;
};

typedef StatCollector *StatCollectorP;
<commit_msg>Switch destructor back to public.  <commit_after>/*---------------------------------------------------------------------------*\
 *                                OpenSG                                     *
 *                                                                           *
 *                                                                           *
 *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
 *                                                                           *
 *                            www.opensg.org                                 *
 *                                                                           *
 *   contact: <EMAIL>, <EMAIL>, <EMAIL>          *
 *                                                                           *
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
 *                                License                                    *
 *                                                                           *
 * This library is free software; you can redistribute it and/or modify it   *
 * under the terms of the GNU Library General Public License as published    *
 * by the Free Software Foundation, version 2.                               *
 *                                                                           *
 * This library 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         *
 * Library General Public License for more details.                          *
 *                                                                           *
 * You should have received a copy of the GNU Library General Public         *
 * License along with this library; if not, write to the Free Software       *
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
 *                                                                           *
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
 *                                Changes                                    *
 *                                                                           *
 *                                                                           *
 *                                                                           *
 *                                                                           *
 *                                                                           *
 *                                                                           *
\*---------------------------------------------------------------------------*/


#ifndef _OSGSTATCOLLECTOR_H_
#define _OSGSTATCOLLECTOR_H_
#ifdef __sgi
#pragma once
#endif

#include "OSGConfig.h"
#include "OSGSystemDef.h"

#include "OSGBaseTypes.h"
#include "OSGFieldTraits.h"
#include "OSGDataType.h"

#include "OSGSField.h"

#include "OSGStatElemDesc.h"
#include "OSGMemoryObject.h"

OSG_BEGIN_NAMESPACE

class StatElem;
class StatElemDescBase;

/*! \brief Manager for Stat elements, see \guide(Statistics) for details.
*/
class OSG_SYSTEM_DLLMAPPING StatCollector : public MemoryObject
{

    /*==========================  PUBLIC  =================================*/

  public:

    typedef MemoryObject Inherited;

    /*---------------------------------------------------------------------*/
    /*! \name                     Instance                                 */
    /*! \{                                                                 */

    UInt32 getNumOfElems(void        ) const;
    void   refitElemNum (void        );
    void   clearElems   (void        );
    bool   isValidID    (Int32 elemId) const;
    void   reset        (StatElemDescBase::ResetMode mode =
                                StatElemDescBase::RESET_DRAW);

    /*! \}                                                                 */
    /*---------------------------------------------------------------------*/
    /*! \name                  Constructor                                 */
    /*! \{                                                                 */

    StatElem *getElem(Int32             elemId       ) const;

    StatElem *getElem(Int32             elemId,
                      bool              create = true);

    StatElem *getElem(StatElemDescBase &desc,
                      bool              create = true);

    template <class T>
    T        *getElem(StatElemDesc<T>  &desc,
                      bool              create = true);

    /*! \}                                                                 */
    /*---------------------------------------------------------------------*/
    /*! \name                  Constructor                                 */
    /*! \{                                                                 */

    void putToString   (      std::string  &outVal) const;
    bool getFromCString(const Char8       *&inVal );
    bool getValue      (      std::string  &name,
                              Real64       &val   );

    /*! \}                                                                 */
    /*---------------------------------------------------------------------*/
    /*! \name                  Constructor                                 */
    /*! \{                                                                 */

    StatCollector(void);
    StatCollector(const StatCollector &source);

    /*---------------------------------------------------------------------*/
    /*! \name                   Destructor                                 */
    /*! \{                                                                 */

    virtual ~StatCollector(void);

    /*! \}                                                                 */


    const StatCollector& operator =(const StatCollector &source);

    /*! \}                                                                 */
    /*---------------------------------------------------------------------*/
    /*! \name                    Create                                    */
    /*! \{                                                                 */

    static StatCollector *create(void);

    /*! \}                                                                 */
    /*---------------------------------------------------------------------*/
    /*! \name                  Comparison                                  */
    /*! \{                                                                 */

    bool operator == (const StatCollector &rhs  ) const;
    bool operator <  (const StatCollector &other) const;

    /*! \}                                                                 */
    /*---------------------------------------------------------------------*/
    /*! \name                     Operators                                */
    /*! \{                                                                 */

    StatCollector  operator +  (const StatCollector &other);
    StatCollector &operator += (const StatCollector &other);

    /*! \}                                                                 */
    /*=========================  PROTECTED  ===============================*/

  protected:

    /*==========================  PRIVATE  ================================*/

  private:

    typedef std::vector<StatElem*>        StatElemStore;
    typedef StatElemStore::iterator       StatElemStoreIt;
    typedef StatElemStore::const_iterator StatElemStoreConstIt;

    StatElemStore _elemVec;
};

typedef StatCollector *StatCollectorP;

{'fraction_non_alphanumeric': 0.21292439732424587, 'fraction_numerical': 0.003534014893348479, 'mean_word_length': 0.5179118773946361, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 205, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2759841', 'n_tokens_mistral': 2626, 'n_tokens_neox': 2408, 'n_words': 601}