// Copyright Onix Solutions Limited [OnixS]. All rights reserved. // // This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law // and international copyright treaties. // // Access to and use of the software is governed by the terms of the applicable OnixS Software // Services Agreement (the Agreement) and Customer end user license agreements granting // a non-assignable, non-transferable and non-exclusive license to use the software // for it's own data processing purposes under the terms defined in the Agreement. // // Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part // of this source code or associated reference material to any other location for further reproduction // or redistribution, and any amendments to this copyright notice, are expressly prohibited. // // Any reproduction or redistribution for sale or hiring of the Software not in accordance with // the terms of the Agreement is a violation of copyright law. // #pragma once #include #include #include "OnixS/CME/MDP3/Types.h" namespace OnixS { namespace CME { namespace MDP3 { /// Zero-based index of CPU. typedef int CpuIndex; /// Represents set of CPU indices. class ONIXS_CME_MDP3_API ThreadAffinity { public: /// Initializes empty set. ThreadAffinity(); /// Initializes as copy of other set. ThreadAffinity(const ThreadAffinity&); /// Re-initializes instance as copy of other set. ThreadAffinity& operator =(const ThreadAffinity&); /// Utilizes all the resources. ~ThreadAffinity(); /// Indicates whether is empty. bool empty() const; /// Copies set into another set. void copyTo(std::set&) const; /// Adds CPU index into set. bool insert(CpuIndex index); /// Removes CPU index from the set. bool erase(CpuIndex index); /// Makes set empty. void clear(); /// Returns textual presentation. std::string toString() const { std::string str; toString(str); return str; } /// Serializes indices into text. void toString(std::string&) const; /// Returns thread affinity of given string presentation. static ThreadAffinity deserialize(const std::string&); private: /// System index. Exportable > indices_; }; } } }