⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fgpropertymanager.h

📁 6 DOF Missle Simulation
💻 H
📖 第 1 页 / 共 2 页
字号:
    bool SetDouble (const string &name, double val);    /**     * Set a string value for a property.     *     * Assign a string value to a property.  If the property does not     * yet exist, it will be created and its type will be set to     * STRING; if it has a type of UNKNOWN, the type will also be set to     * STRING; otherwise, the string value will be converted to the property's     * type.     *     * @param name The property name.     * @param val The new value for the property.     * @return true if the assignment succeeded, false otherwise.     */    bool SetString (const string &name, const string &val);    ////////////////////////////////////////////////////////////////////////    // Convenience functions for setting property attributes.    ////////////////////////////////////////////////////////////////////////    /**     * Set the state of the archive attribute for a property.     *     * If the archive attribute is true, the property will be written     * when a flight is saved; if it is false, the property will be     * skipped.     *     * A warning message will be printed if the property does not exist.     *     * @param name The property name.     * @param state The state of the archive attribute (defaults to true).     */    void SetArchivable (const string &name, bool state = true);    /**     * Set the state of the read attribute for a property.     *     * If the read attribute is true, the property value will be readable;     * if it is false, the property value will always be the default value     * for its type.     *     * A warning message will be printed if the property does not exist.     *     * @param name The property name.     * @param state The state of the read attribute (defaults to true).     */    void SetReadable (const string &name, bool state = true);    /**     * Set the state of the write attribute for a property.     *     * If the write attribute is true, the property value may be modified     * (depending on how it is tied); if the write attribute is false, the     * property value may not be modified.     *     * A warning message will be printed if the property does not exist.     *     * @param name The property name.     * @param state The state of the write attribute (defaults to true).     */    void SetWritable (const string &name, bool state = true);    ////////////////////////////////////////////////////////////////////////    // Convenience functions for tying properties, with logging.    ////////////////////////////////////////////////////////////////////////    /**     * Untie a property from an external data source.     *     * Classes should use this function to release control of any     * properties they are managing.     */    void Untie (const string &name);        // Templates cause ambiguity here    /**     * Tie a property to an external bool variable.     *     * The property's value will automatically mirror the variable's     * value, and vice-versa, until the property is untied.     *     * @param name The property name to tie (full path).     * @param pointer A pointer to the variable.     * @param useDefault true if any existing property value should be     *        copied to the variable; false if the variable should not     *        be modified; defaults to true.     */    void    Tie (const string &name, bool *pointer, bool useDefault = true);    /**     * Tie a property to an external int variable.     *     * The property's value will automatically mirror the variable's     * value, and vice-versa, until the property is untied.     *     * @param name The property name to tie (full path).     * @param pointer A pointer to the variable.     * @param useDefault true if any existing property value should be     *        copied to the variable; false if the variable should not     *        be modified; defaults to true.     */    void    Tie (const string &name, int *pointer, bool useDefault = true);    /**     * Tie a property to an external long variable.     *     * The property's value will automatically mirror the variable's     * value, and vice-versa, until the property is untied.     *     * @param name The property name to tie (full path).     * @param pointer A pointer to the variable.     * @param useDefault true if any existing property value should be     *        copied to the variable; false if the variable should not     *        be modified; defaults to true.     */    void    Tie (const string &name, long *pointer, bool useDefault = true);    /**     * Tie a property to an external float variable.     *     * The property's value will automatically mirror the variable's     * value, and vice-versa, until the property is untied.     *     * @param name The property name to tie (full path).     * @param pointer A pointer to the variable.     * @param useDefault true if any existing property value should be     *        copied to the variable; false if the variable should not     *        be modified; defaults to true.     */    void    Tie (const string &name, float *pointer, bool useDefault = true);    /**     * Tie a property to an external double variable.     *     * The property's value will automatically mirror the variable's     * value, and vice-versa, until the property is untied.     *     * @param name The property name to tie (full path).     * @param pointer A pointer to the variable.     * @param useDefault true if any existing property value should be     *        copied to the variable; false if the variable should not     *        be modified; defaults to true.     */    void    Tie (const string &name, double *pointer, bool useDefault = true);//============================================================================////  All of the following functions *must* be inlined, otherwise linker//  errors will result////============================================================================    /* template <class V> void    Tie (const string &name, V (*getter)(), void (*setter)(V) = 0,           bool useDefault = true);    template <class V> void    Tie (const string &name, int index, V (*getter)(int),           void (*setter)(int, V) = 0, bool useDefault = true);    template <class T, class V> void    Tie (const string &name, T * obj, V (T::*getter)() const,           void (T::*setter)(V) = 0, bool useDefault = true);    template <class T, class V> void    Tie (const string &name, T * obj, int index,           V (T::*getter)(int) const, void (T::*setter)(int, V) = 0,           bool useDefault = true); */     /**     * Tie a property to a pair of simple functions.     *     * Every time the property value is queried, the getter (if any) will     * be invoked; every time the property value is modified, the setter     * (if any) will be invoked.  The getter can be 0 to make the property     * unreadable, and the setter can be 0 to make the property     * unmodifiable.     *     * @param name The property name to tie (full path).     * @param getter The getter function, or 0 if the value is unreadable.     * @param setter The setter function, or 0 if the value is unmodifiable.     * @param useDefault true if the setter should be invoked with any existing     *        property value should be; false if the old value should be     *        discarded; defaults to true.     */    template <class V> inline void    Tie (const string &name, V (*getter)(), void (*setter)(V) = 0, bool useDefault = true)    {      if (!tie(name.c_str(), SGRawValueFunctions<V>(getter, setter), useDefault))        cout << "Failed to tie property " << name << " to functions" << endl;      else if (debug_lvl & 0x20)        cout << name << endl;    }    /**     * Tie a property to a pair of indexed functions.     *     * Every time the property value is queried, the getter (if any) will     * be invoked with the index provided; every time the property value     * is modified, the setter (if any) will be invoked with the index     * provided.  The getter can be 0 to make the property unreadable, and     * the setter can be 0 to make the property unmodifiable.     *     * @param name The property name to tie (full path).     * @param index The integer argument to pass to the getter and     *        setter functions.     * @param getter The getter function, or 0 if the value is unreadable.     * @param setter The setter function, or 0 if the value is unmodifiable.     * @param useDefault true if the setter should be invoked with any existing     *        property value should there be one; false if the old value should be     *        discarded; defaults to true.     */    template <class V> inline void Tie (const string &name, int index, V (*getter)(int),                                void (*setter)(int, V) = 0, bool useDefault = true)    {      if (!tie(name.c_str(), SGRawValueFunctionsIndexed<V>(index, getter, setter), useDefault))        cout << "Failed to tie property " << name << " to indexed functions" << endl;      else if (debug_lvl & 0x20)        cout << name << endl;    }    /**     * Tie a property to a pair of object methods.     *     * Every time the property value is queried, the getter (if any) will     * be invoked; every time the property value is modified, the setter     * (if any) will be invoked.  The getter can be 0 to make the property     * unreadable, and the setter can be 0 to make the property     * unmodifiable.     *     * @param name The property name to tie (full path).     * @param obj The object whose methods should be invoked.     * @param getter The object's getter method, or 0 if the value is     *        unreadable.     * @param setter The object's setter method, or 0 if the value is     *        unmodifiable.     * @param useDefault true if the setter should be invoked with any existing     *        property value should there be one; false if the old value should be     *        discarded; defaults to true.     */    template <class T, class V> inline void    Tie (const string &name, T * obj, V (T::*getter)() const,           void (T::*setter)(V) = 0, bool useDefault = true)    {      if (!tie(name.c_str(), SGRawValueMethods<T,V>(*obj, getter, setter), useDefault))        cout << "Failed to tie property " << name << " to object methods" << endl;      else if (debug_lvl & 0x20)        cout << name << endl;    }    /**     * Tie a property to a pair of indexed object methods.     *     * Every time the property value is queried, the getter (if any) will     * be invoked with the index provided; every time the property value     * is modified, the setter (if any) will be invoked with the index     * provided.  The getter can be 0 to make the property unreadable, and     * the setter can be 0 to make the property unmodifiable.     *     * @param name The property name to tie (full path).     * @param obj The object whose methods should be invoked.     * @param index The integer argument to pass to the getter and     *        setter methods.     * @param getter The getter method, or 0 if the value is unreadable.     * @param setter The setter method, or 0 if the value is unmodifiable.     * @param useDefault true if the setter should be invoked with any existing     *        property value should be; false if the old value should be     *        discarded; defaults to true.     */    template <class T, class V> inline void    Tie (const string &name, T * obj, int index, V (T::*getter)(int) const,                         void (T::*setter)(int, V) = 0, bool useDefault = true)    {      if (!tie(name.c_str(), SGRawValueMethodsIndexed<T,V>(*obj, index, getter, setter), useDefault))        cout << "Failed to tie property " << name << " to indexed object methods" << endl;      else if (debug_lvl & 0x20)        cout << name << endl;   }};}#endif // FGPROPERTYMANAGER_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -