// snfCFGmgr.inline.hpp
//
// (C) Copyright 2006 - 2009 ARM Research Labs, LLC.
//
// Inline functions/methods for snfCFGmgr module.

//// IntegerSetHandler /////////////////////////////////////////////////////////

inline bool IntegerSetHandler::isListed(int x) {                                // How to check if an int is listed.
    return (IntegerSet.end() != IntegerSet.find(x));
}


//// snfCFGmgr /////////////////////////////////////////////////////////////////

inline snfCFGmgr::snfCFGmgr() :                                                 // We construct a CFGmgr this way...
   AisActive(false),                                                            // So that A is active after 1st load()
   InitFileName(""),                                                            // and all of the Init strings are
   InitLicenseId(""),                                                           // empty.
   InitAuthentication(""),
   ConfigurationPath("") {
}

inline void snfCFGmgr::swapCFGData() {                                          // This swaps the active dataset.
    AisActive = (AisActive)?false:true;
}

inline snfCFGData& snfCFGmgr::ActiveData() {                                    // This returns the active dataset.
    return (AisActive) ? A : B;
}

inline snfCFGData& snfCFGmgr::InactiveData() {                                  // This returns the inactive dataset.
    return (AisActive) ? B : A;
}

inline string snfCFGmgr::RuleFilePath() {                                       // Rulebase file path
    return ActiveData().RuleFilePath;
}

inline string snfCFGmgr::SecurityKey() {                                        // Security key for rulebase
    return ActiveData().SecurityKey;
}

inline snfCFGData* snfCFGmgr::ActiveConfiguration() {                           // Pointer to active configuration
    return &(ActiveData());
}
