17 #ifndef __PRM_Instance_h__
18 #define __PRM_Instance_h__
71 UT_SMALLOBJECT_CLEANPAGES_DEFAULT,
72 UT_SMALLOBJECT_PAGESIZE_DEFAULT,
73 UT_SMALLOBJECT_THREADSAFE_OFF>
83 virtual void adoptOverrides(
PRM_Instance &thesrcinstance);
89 virtual void revertToDefault(
int index) = 0;
90 virtual void revertToDefaults(
bool clear_channels =
true) = 0;
91 virtual void restoreFactoryDefault(
int index) = 0;
92 virtual void overwriteDefault(
fpreal time,
int index) = 0;
93 virtual void overwriteDefaults(
fpreal time) = 0;
95 bool basiccheck =
true)
const;
98 virtual void save(std::ostream &os,
int binary,
bool compiled)
const=0;
104 virtual void saveCommand(std::ostream &os,
int values=0,
int index = -1)
106 virtual int loadCommand(
int argc,
const char *
const argv[],
116 int64 &value,
int index,
117 int thread)
const = 0;
120 int thread)
const = 0;
123 bool expand,
int thread)
const = 0;
126 int thread)
const = 0;
129 bool expand,
int thread)
const = 0;
135 int32 *theints,
int thread)
const;
137 int64 *theints,
int thread)
const;
138 virtual void getDefaultValue(
fpreal &value,
int index)
const;
139 virtual void getDefaultValue(
int32 &value,
int index)
const;
140 virtual void getDefaultValue(
int64 &value,
int index)
const;
141 virtual void getDefaultValue(
UT_String &value,
int index)
const;
143 virtual void getExpressionStringForUI(
fpreal time,
146 int thread)
const = 0;
148 int index,
bool allow_value,
149 int thread)
const = 0;
150 virtual void setExpression(
fpreal time,
153 int index,
bool evaluate =
true,
154 bool rmchannel =
false);
167 bool isLanguageOldExprOrLiteral(
fpreal time,
int index)
const;
175 bool kill_expr =
false,
182 bool kill_expr =
false,
189 bool kill_expr =
false,
196 bool kill_expr =
false,
203 bool kill_expr =
false,
211 virtual void setValues(
fpreal time,
213 bool kill_expr =
false,
217 virtual void setValues(
fpreal time,
219 bool kill_expr =
false,
223 virtual void setDefaultChannelValue(
CH_Channel *channelptr,
226 virtual bool isMultiParm()
const;
227 virtual int getMultiParmNumItems()
const;
228 virtual int getMultiParmInstancesPerItem()
const;
229 virtual const char *getMultiParmToken(
int p,
int index)
const;
232 virtual void insertMultiParmItem(
int index);
233 virtual void removeMultiParmItem(
int index);
235 virtual void buildOpDependencies(
const PRM_RefId &
ref,
int thread);
236 virtual void changeOpRef(
const char *new_fullpath,
237 const char *old_fullpath,
239 const char *chan_name,
240 const char *old_chan_name,
241 void (*undo_callback)(
void *),
248 virtual int findString(
const char *str,
bool fullword,
249 bool usewildcards)
const;
250 virtual int changeString(
const char *from,
const char *to,
253 virtual bool notifyVarChange(
int subindex,
const char *varname);
257 fpreal t,
bool add_if_default ,
260 unsigned getEnableState(
int comp = -1)
const;
261 bool setEnableState(
bool f,
int comp = -1);
265 return myBitField & BITFLAG_EXPRESSIONSTATE;
270 myBitField |= BITFLAG_EXPRESSIONSTATE;
272 myBitField &= ~BITFLAG_EXPRESSIONSTATE;
276 return myBitField & BITFLAG_VALUESTATE;
281 myBitField |= BITFLAG_VALUESTATE;
283 myBitField &= ~BITFLAG_VALUESTATE;
287 int index)
const {
return true; }
289 int index)
const {
return true; }
294 ? getParmList()->getChannelGroupPtr()
316 && subindex < getVectorSize());
317 return myChannelPtrs[subindex];
321 myChannelPtrs[subindex] = chp;
324 void reloadChannelPtrs();
326 void internalAddChannel(
int index,
329 bool add_seg =
true);
330 void addChannel(
int index);
332 void addChannel(
int index,
const char *theexpr,
336 bool removeChannel(
int index);
337 int getChannelCount()
const;
341 virtual bool isTimeDependent(
int subindex)
const;
342 virtual bool isDataDependent(
fpreal gtime,
int subindex)
const;
344 virtual void setTimeDependent(
int subindex,
bool timedep);
349 bool hasContextOptionDeps(
int subindex)
const;
351 void addContextOptionDep(
int subindex,
354 int changePending(
int index);
359 virtual void hardenChanges(
fpreal time,
362 const char *patt = 0,
366 void setKey(
fpreal time,
int index);
367 void setKey(
fpreal time,
int index,
const char *expr,
369 const char *patt = 0,
372 void setFullKey(
fpreal gtime,
int index,
374 bool accel_ratios =
true);
377 {
return myBitField & BITFLAG_SAVE_MASK; }
379 { myBitField |= (f & BITFLAG_SAVE_MASK); }
382 {
return myBitField & BITFLAG_ACTIVETAKE; }
384 {
return myBitField & BITFLAG_TAKEALWAYSACTIVE; }
387 if (onoff) myBitField |= BITFLAG_ACTIVETAKE;
390 if (!(myBitField & BITFLAG_TAKEALWAYSACTIVE))
391 myBitField &= ~BITFLAG_ACTIVETAKE;
392 else myBitField |= BITFLAG_ACTIVETAKE;
397 {
return myBitField & BITFLAG_BYPASS; }
401 if (isSpareParm() && onoff)
402 myBitField |= BITFLAG_BYPASS;
404 myBitField &= ~BITFLAG_BYPASS;
407 bool getVisibleState(
int comp = -1)
const;
408 void setVisibleState(
bool f,
int comp = -1);
411 {
return myBitField & BITFLAG_UNDOSAVED; }
413 {
if (f) myBitField |= BITFLAG_UNDOSAVED;
414 else myBitField &= ~BITFLAG_UNDOSAVED;}
416 {
return myBitField & BITFLAG_AUTOTAKEUNDOSAVED; }
418 {
if (f) myBitField |= BITFLAG_AUTOTAKEUNDOSAVED;
419 else myBitField &= ~BITFLAG_AUTOTAKEUNDOSAVED;}
422 {
return myBitField & BITFLAG_SAVEAUTOSCOPE; }
425 {
return myBitField & BITFLAG_SAVEAUTOSELECT; }
427 void setSaveLabelFlag(
bool f);
429 {
return myBitField & BITFLAG_SAVELABEL; }
431 bool getLockedFlag(
int vec_idx)
const;
432 bool areAllComponentsLocked()
const;
433 void setLockedFlag(
int vec_idx,
bool f);
434 bool getAutoScopedFlag(
int vec_idx)
const;
435 void setAutoScopedFlag(
int vec_idx,
bool f);
438 {
return (myBitField & BITFLAG_DEFAULTSINIT) != 0; }
440 {
if (f) myBitField |= BITFLAG_DEFAULTSINIT;
441 else myBitField &= ~BITFLAG_DEFAULTSINIT;}
444 {
return myLockField; }
446 {
return myAutoScopeField; }
448 virtual int setOverride(
int index,
int data_idx,
451 virtual int setOverrideDisable(
int index,
int onoff);
452 virtual const char *getOverride(
int index)
const;
453 virtual bool getOverrideType(
int index,
455 virtual int getOverrideDataIndex(
int index)
const;
462 virtual int getIsOverrideActive(
int index)
const;
468 {
return getFieldBit(myDirtyParmFlags, vec_idx); }
470 {
return !myDirtyParmFlags; }
472 { myDirtyParmFlags = 0; }
475 setFieldBit(myDirtyParmFlags, vec_idx,
true);
476 setSendExtra(vec_idx);
482 {
return getFieldBit(mySendExtraFlags, vi); }
484 {
return (mySendExtraFlags != 0); }
487 if (!getFieldBit(mySendExtraFlags, vi))
489 setFieldBit(mySendExtraFlags, vi,
true);
490 getParmList()->bumpNumSendExtra(
491 vi < 0 ? getVectorSize() : +1);
500 void createInputNotifyValue();
505 {
return myTemplatePtr->getType(); }
507 {
return myTemplatePtr->getTypeExtended(); }
509 {
return myTemplatePtr->getMultiType(); }
511 {
return myTemplatePtr->getMultiSize(); }
513 {
return myTemplatePtr->getMultiStartOffset(); }
519 {
return myTemplatePtr->getToken(); }
521 {
return myTemplatePtr->getLabel(); }
523 {
return myTemplatePtr->getCallback(); }
525 {
return myTemplatePtr->getVectorSize(); }
527 {
return myTemplatePtr->getRangePtr(); }
529 { myTemplatePtr->getChannelToken(chname, i); }
531 {
return myTemplatePtr->getChannelToken(i); }
533 {
return myTemplatePtr->getChoiceListPtr(); }
542 bool hasChannelAlias(
int index)
const;
543 void getChannelAlias(
UT_String &strref,
int index)
const;
552 bool allow_alias)
const;
555 {
return myParm->getParmOwner(); }
557 {
return myParm->getOwner(); }
561 static bool isChanRefString(
const char *str,
bool is_expr,
563 static bool isObsoleteDirectChanRefString(
const char *str,
573 bool isActive(
const int index)
const;
574 void setActive(
const int index,
const bool active);
577 bool isSpareParm()
const;
578 void setSpareParm(
bool spare);
582 void setMultiParmOwner(
const PRM_Multi *multiparmowner);
600 bool instance_index=
true)
const;
602 bool validIndex(
int index)
const;
604 virtual int64 getMemoryUsage(
bool inclusive)
const;
622 {
return (myMicroNodes !=
nullptr); }
624 void clearMicroNodeInputs();
626 int getMicroNodeNumInputs()
const;
633 bool *dirtied_data =
nullptr);
637 int indent_level)
const;
638 int64 getMicroNodesMemoryUsage()
const;
641 bool hasChannelCustomColor(
int index)
const;
642 const UT_Color &getChannelCustomColor(
int index)
const;
643 void setChannelCustomColor(
int index,
const UT_Color &
c);
644 void resetChannelCustomColor(
int index);
646 bool getAutoSelectFlag(
int vec_idx)
const;
647 void setAutoSelectFlag(
int vec_idx,
bool f);
649 {
return myAutoSelectField; }
651 void setTimeDependentMicroNode(
int subindex,
bool timedep);
660 void clearAndDestroyChannels();
663 void indexError(
int index);
666 { myLockField = locks; }
669 myAutoScopeField = field;
670 myBitField |= BITFLAG_SAVEAUTOSCOPE;
675 myAutoSelectField = field;
676 myBitField |= BITFLAG_SAVEAUTOSELECT;
681 const PRM_ParmList *thelist,
int vector_index,
int thread)
const
684 err = ev_GetErrNo(thread);
686 evaluationError(thelist, vector_index, err, thread);
689 bool validateAccess();
694 void loadTokenAsChannelNameOrExpression(
706 bool loadBinaryOption(
UT_IStream &is,
short packet_id);
713 void saveAsciiOptions(std::ostream &os)
const;
714 bool saveBinaryOptions(
int class_packet_id,
716 std::ostream &os)
const;
736 static const char *getPacketIOToken(PRM_ParmIOToken token);
737 static int getPacketIOTokenLen(PRM_ParmIOToken token);
738 static int getPacketIOBinaryId(PRM_ParmIOToken token);
743 static bool comparePacketIOToken(PRM_ParmIOToken token,
749 bool shouldSaveData()
const;
753 inline bool getFieldBit(
unsigned int field,
int i)
const
758 return ((field & (1 << (
unsigned)i)) != 0);
760 inline void setFieldBit(
unsigned int &field,
int i,
bool f)
765 field = (1<<(unsigned)getVectorSize()) - 1;
772 field |= (1 << (unsigned)i);
774 field &= ~(1 << (unsigned)i);
784 void validateChannelName(
PRM_ParmList &list,
int subindex);
786 void evaluationError(
788 int vector_index,
int err,
int thread)
const;
804 BITFLAG_EXPRESSIONSTATE = 0x0008,
805 BITFLAG_UNDOSAVED = 0x0010,
806 BITFLAG_ACTIVETAKE = 0x0020,
807 BITFLAG_TAKEALWAYSACTIVE = 0x0040,
808 BITFLAG_SAVEAUTOSCOPE = 0x0080,
809 BITFLAG_SPAREPARM = 0x0100,
810 BITFLAG_AUTOTAKEUNDOSAVED = 0x0400,
811 BITFLAG_DEFAULTSINIT = 0x0800,
812 BITFLAG_VALUESTATE = 0x1000,
813 BITFLAG_BYPASS = 0x2000,
814 BITFLAG_SAVELABEL = 0x4000,
815 BITFLAG_SAVEAUTOSELECT = 0x8000,
818 BITFLAG_SAVE_MASK = (BITFLAG_EXPRESSIONSTATE)
821 unsigned int myBitField;
822 unsigned int myEnableField;
823 unsigned int myLockField;
824 unsigned int myAutoScopeField;
825 unsigned int myVisibleField;
826 unsigned int myAutoSelectField;
829 unsigned int myActiveField;
834 unsigned myDirtyParmFlags;
835 unsigned mySendExtraFlags;
841 struct ChannelCustomColor
844 { myHasCustomColor =
false; }
846 bool myHasCustomColor;
848 ChannelCustomColor *myChannelColors;
851 const PRM_Multi *myMultiParmOwner;
860 bool allow_alias)
const
862 int size = myTemplatePtr->getVectorSize();
866 if (allow_alias && myChannelAliases)
868 for (i = 0; i <
size; i++)
870 if (myChannelAliases[i] == thechannelname)
879 retval = myTemplatePtr->findSubIndex(thechannelname);
888 return myEnableField;
890 return ( myEnableField & (1<<comp) ) ? 1 : 0;
898 if (!getVectorSize())
899 return (myVisibleField != 0);
901 return getFieldBit(myVisibleField, comp);
908 setFieldBit(myVisibleField, comp, f);
CH_Manager * getManager() const
unsigned int getSaveFlags() const
bool getVisibleState(int comp=-1) const
bool isSendExtra(int vi) const
void setUndoSavedFlag(bool f)
GLsizei GLenum const void * indices
const PRM_Template * getTemplatePtr() const
UT_JSONValueMap stores a map/dictionary of UT_JSONValue objects.
void setAutoScopeField(unsigned int field)
void setSaveFlags(unsigned int f)
const UT_StringHolder & getChannelToken(int i) const
GT_API const UT_StringHolder time
UT_SharedPtr< PRM_UndoData > PRM_UndoDataHandle
const PRM_Template * getMultiParmTemplate() const
bool isDirty(int vec_idx) const
const PRM_ChoiceList * getChoiceListPtr() const
const GLuint GLenum const void * binary
UT_ConcurrentSet< UT_StringHolder > DEP_ContextOptionDeps
GLsizei const GLchar *const * path
SYS_FORCE_INLINE T * SYSconst_cast(const T *foo)
int getExpressionState() const
bool getSaveAutoSelectFlag() const
const char * getToken() const
int getVectorSize() const
unsigned getEnableState(int comp=-1) const
__hostdev__ void setValue(uint32_t offset, bool v)
const PRM_Value * inputNotifyValue() const
bool getSaveLabelFlag() const
bool hasAnySendExtraFlags() const
void setChannel(int subindex, CH_Channel *chp)
void setDefaultsInitFlag(bool f)
__hostdev__ float getValue(uint32_t i) const
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
virtual bool isRotationParm() const
PRM_TypeExtended getTypeExtended() const
CH_Channel * getChannel(int subindex) const
void clearAllDirtyFlags()
PRM_Template * getTemplatePtr()
int findSubIndex(const UT_StringRef &thechannelname, bool allow_alias) const
void setDirtyFlags(int vec_idx)
bool getDefaultsInitFlag() const
virtual bool isEditable(PRM_ParmList *thelist, fpreal time, int index) const
bool getBypassFlag() const
fpreal getGlobalStart() const
void setVisibleState(bool f, int comp=-1)
SYS_FORCE_INLINE void checkForExpressionErrors(const PRM_ParmList *thelist, int vector_index, int thread) const
PRM_Template * getMultiParmTemplate()
UT_Function< void(DEP_MicroNode &, DEP_MicroNode &) > Visitor
fpreal getMultiSize() const
GLsizei GLsizei GLchar * source
void setLockField(unsigned int locks)
void setActiveTakeFlag(int onoff)
const char * getLabel() const
void setBypassFlag(bool onoff)
GLuint const GLchar * name
bool getAlwaysTakeFlag() const
unsigned int getAutoScopeField() const
const PRM_Type & getType() const
that also have some descendant prim *whose name begins with which in turn has a child named baz where *the predicate active
virtual void destroyChildParms()
unsigned int getLockField() const
PRM_Callback getCallback() const
fpreal getEvaluateTime(int thread) const
Functions for obtaining and setting the current evaluation time.
**Note that the tasks the is the thread number *for the or if it s being executed by a non pool thread(this *can happen in cases where the whole pool is occupied and the calling *thread contributes to running the work load).**Thread pool.Have fun
PRM_MultiType getMultiType() const
bool getSaveAutoScopeFlag() const
const PRM_Template * getMultiParmTemplate() const
virtual bool isEditableByUI(PRM_ParmList *thelist, fpreal time, int index) const
const PRM_Range * getRangePtr() const
SIM_API const UT_StringHolder force
GLenum GLsizei GLsizei GLint * values
PRM_ParmOwner * getParmOwner() const
bool areAllFlagsClean() const
PRM_Parm * getParm() const
int getValueState() const
void setExpressionState(int state)
bool getAutoTakeUndoSavedFlag()
fpreal getGlobalStartTime() const
void getChannelToken(UT_String &chname, int i) const
void setTimeDependentForEval(int vi, bool timedep) const
void setSendExtra(int vi)
unsigned int getAutoSelectField() const
bool hasMicroNodes() const
Return true if this parameter has micronodes, NOT thread-safe.
CH_Collection * getChannelGroupPtr() const
void setAutoTakeUndoSavedFlag(bool f)
int getMultiStartOffset() const
void setAutoSelectField(unsigned int field)
void setValueState(int state)
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
PRM_Value * inputNotifyValue()
PRM_MultiType
This type enum defines the different types of multi (dynamic) parameters.
bool getActiveTakeFlag() const
fpreal getEvalTime(int thread) const
PRM_ParmList * getParmList() const