#ifndef _adskRepresentationCmd_h_
#define _adskRepresentationCmd_h_
#include <maya/MPxCommand.h>
#include <maya/MArgDatabase.h>
#include <cassert>
public:
static const char* name();
static void* creator();
AdskRepresentationCmd();
virtual ~AdskRepresentationCmd();
private:
enum Mode {
kEdit = 1 << 0,
kQuery = 1 << 1
};
template <class T, Mode ValidModes>
class OptFlag
{
public:
OptFlag() : fIsSet(false), fArg() {}
{
}
bool isModeValid(const Mode currentMode)
{
return !fIsSet || ((currentMode & ValidModes) != 0);
}
bool isSet() const { return fIsSet; }
bool isArgValid() const { return fIsArgValid; }
const T& arg() const { return fArg; }
const T& arg(const T& defValue) const {
if (isSet()) {
assert(isArgValid());
return fArg;
}
else {
return defValue;
}
}
private:
bool fIsSet;
bool fIsArgValid;
T fArg;
};
template <Mode ValidModes>
class OptFlag<void, ValidModes>
{
public:
OptFlag() : fIsSet(false) {}
{
}
bool isModeValid(const Mode currentMode)
{
return !fIsSet || ((currentMode & ValidModes) != 0);
}
bool isSet() const { return fIsSet; }
private:
bool fIsSet;
};
bool needObjectArg() const;
Mode fMode;
OptFlag<MString, Mode(kEdit|kQuery)> fTypeLabelFlag;
OptFlag<MString, Mode(kEdit|kQuery)> fAERepresentationProcFlag;
OptFlag<MString, Mode(kQuery)> fListRepTypesFlag;
};
#endif