// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers.  See the top-level LICENSE file for dates and other
// details.  No copyright assignment is required to contribute to VisIt.

#ifndef DBOPTIONSATTRIBUTES_H
#define DBOPTIONSATTRIBUTES_H
#include <state_exports.h>
#include <string>
#include <AttributeSubject.h>


// ****************************************************************************
// Class: DBOptionsAttributes
//
// Purpose:
//    Attributes of database options
//
// Notes:      Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

class STATE_API DBOptionsAttributes : public AttributeSubject
{
public:
    enum OptionType
    {
        Bool,
        Int,
        Float,
        Double,
        String,
        Enum,
        MultiLineString
    };

    // These constructors are for objects of this class
    DBOptionsAttributes();
    DBOptionsAttributes(const DBOptionsAttributes &obj);
protected:
    // These constructors are for objects derived from this class
    DBOptionsAttributes(private_tmfs_t tmfs);
    DBOptionsAttributes(const DBOptionsAttributes &obj, private_tmfs_t tmfs);
public:
    virtual ~DBOptionsAttributes();

    virtual DBOptionsAttributes& operator = (const DBOptionsAttributes &obj);
    virtual bool operator == (const DBOptionsAttributes &obj) const;
    virtual bool operator != (const DBOptionsAttributes &obj) const;
private:
    void Init();
    void Copy(const DBOptionsAttributes &obj);
public:

    virtual const std::string TypeName() const;
    virtual bool CopyAttributes(const AttributeGroup *);
    virtual AttributeSubject *CreateCompatible(const std::string &) const;
    virtual AttributeSubject *NewInstance(bool) const;

    // Property selection methods
    virtual void SelectAll();
    void SelectTypes();
    void SelectNames();
    void SelectOptBools();
    void SelectOptFloats();
    void SelectOptDoubles();
    void SelectOptInts();
    void SelectOptStrings();
    void SelectOptEnums();
    void SelectOptMultiLineStrings();
    void SelectEnumStrings();
    void SelectEnumStringsSizes();
    void SelectObsoleteNames();
    void SelectHelp();

    // Property setting methods
    void SetTypes(const intVector &types_);
    void SetNames(const stringVector &names_);
    void SetOptBools(const intVector &optBools_);
    void SetOptFloats(const doubleVector &optFloats_);
    void SetOptDoubles(const doubleVector &optDoubles_);
    void SetOptInts(const intVector &optInts_);
    void SetOptStrings(const stringVector &optStrings_);
    void SetOptEnums(const intVector &optEnums_);
    void SetOptMultiLineStrings(const stringVector &optMultiLineStrings_);
    void SetEnumStrings(const stringVector &enumStrings_);
    void SetEnumStringsSizes(const intVector &enumStringsSizes_);
    void SetObsoleteNames(const stringVector &obsoleteNames_);
    void SetHelp(const std::string &help_);

    // Property getting methods
    const intVector    &GetTypes() const;
          intVector    &GetTypes();
    const stringVector &GetNames() const;
          stringVector &GetNames();
    const intVector    &GetOptBools() const;
          intVector    &GetOptBools();
    const doubleVector &GetOptFloats() const;
          doubleVector &GetOptFloats();
    const doubleVector &GetOptDoubles() const;
          doubleVector &GetOptDoubles();
    const intVector    &GetOptInts() const;
          intVector    &GetOptInts();
    const stringVector &GetOptStrings() const;
          stringVector &GetOptStrings();
    const intVector    &GetOptEnums() const;
          intVector    &GetOptEnums();
    const stringVector &GetOptMultiLineStrings() const;
          stringVector &GetOptMultiLineStrings();
    const stringVector &GetEnumStrings() const;
          stringVector &GetEnumStrings();
    const intVector    &GetEnumStringsSizes() const;
          intVector    &GetEnumStringsSizes();
    const stringVector &GetObsoleteNames() const;
          stringVector &GetObsoleteNames();
    const std::string  &GetHelp() const;
          std::string  &GetHelp();

    // Persistence methods
    virtual bool CreateNode(DataNode *node, bool completeSave, bool forceAdd);
    virtual void SetFromNode(DataNode *node);

    // Enum conversion functions
    static std::string OptionType_ToString(OptionType);
    static bool OptionType_FromString(const std::string &, OptionType &);
protected:
    static std::string OptionType_ToString(int);
public:

    // Keyframing methods
    virtual std::string               GetFieldName(int index) const;
    virtual AttributeGroup::FieldType GetFieldType(int index) const;
    virtual std::string               GetFieldTypeName(int index) const;
    virtual bool                      FieldsEqual(int index, const AttributeGroup *rhs) const;

    // User-defined methods
    int FindIndex(const std::string &name) const;
    void SetBool(const std::string &name, bool defaultValue);
    bool GetBool(const std::string &name) const;
    void SetFloat(const std::string &name, float defaultValue);
    float GetFloat(const std::string &name) const;
    void SetDouble(const std::string &name, double defaultValue);
    double GetDouble(const std::string &name) const;
    void SetInt(const std::string &name, int defaultValue);
    int GetInt(const std::string &name) const;
    void SetString(const std::string &name, const std::string &defaultValue);
    const std::string &GetString(const std::string &name) const;
    void SetEnum(const std::string &name, int defaultValue);
    int GetEnum(const std::string &name) const;
    void SetEnumStrings(const std::string &name, const std::vector<std::string> &values);
    const std::string &GetMultiLineString(const std::string &name) const;
    void SetMultiLineString(const std::string &name, const std::string &defaultValue);
    int GetNumberOfOptions(void) const;
    DBOptionsAttributes::OptionType GetType(int) const;
    std::vector<std::string> GetEnumStrings(const std::string &name) const;
    std::string GetName(int) const;
    void SetObsolete(const std::string &name);
    bool IsObsolete(const std::string &name) const;
    bool Merge(const DBOptionsAttributes &obj);

    // IDs that can be used to identify fields in case statements
    enum {
        ID_types = 0,
        ID_names,
        ID_optBools,
        ID_optFloats,
        ID_optDoubles,
        ID_optInts,
        ID_optStrings,
        ID_optEnums,
        ID_optMultiLineStrings,
        ID_enumStrings,
        ID_enumStringsSizes,
        ID_obsoleteNames,
        ID_help,
        ID__LAST
    };

private:
    intVector    types;
    stringVector names;
    intVector    optBools;
    doubleVector optFloats;
    doubleVector optDoubles;
    intVector    optInts;
    stringVector optStrings;
    intVector    optEnums;
    stringVector optMultiLineStrings;
    stringVector enumStrings;
    intVector    enumStringsSizes;
    stringVector obsoleteNames;
    std::string  help;

    // Static class format string for type map.
    static const char *TypeMapFormatString;
    static const private_tmfs_t TmfsStruct;
};
#define DBOPTIONSATTRIBUTES_TMFS "i*s*i*d*d*i*s*i*s*s*i*s*s"

#endif
