tizen beta release
[framework/web/wrt-plugins-common.git] / src / modules / API / Cpu / IManager.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 #ifndef WRTDEVICEAPIS_CPU_IMANAGER_H_
17 #define WRTDEVICEAPIS_CPU_IMANAGER_H_
18
19 #include <cstddef>
20 #include <dpl/noncopyable.h>
21 #include <Cpu/IUnit.h>
22
23 namespace WrtDeviceApis {
24 namespace Cpu {
25 namespace Api {
26
27 class IManager : private DPL::Noncopyable
28 {
29   public:
30     static IManager& getInstance();
31
32   public:
33     virtual ~IManager() = 0;
34
35     /**
36      * Gets interface to CPU.
37      * @param index Index of CPU to get (1-based).
38      * @return Interface to CPU.
39      * @throw PlatformException If platform error occurs.
40      * @throw OutOfRangeException If index is greater than available CPUs.
41      * @remarks On some platforms passing 0 as index may return unit object
42      *          that gives avarage data for all CPUs. If such interface is
43      *          not supported then NULL is returned.
44      * @remarks Ownership is NOT passed to the caller.
45      */
46     virtual IUnit* getUnit(std::size_t index) const = 0;
47
48     /**
49      * Gets number of available CPUs.
50      * @return Number of CPUs.
51      */
52     virtual std::size_t getUnitsCount() const = 0;
53 };
54
55 } // Api
56 } // Cpu
57 } // WrtDeviceApis
58
59 #endif // WRTDEVICEAPIS_CPU_IMANAGER_H_