Line 1... |
Line 1... |
/**
|
/*
|
* @file
|
* Copyright 2018 Sergey Khabarov, sergeykhbr@gmail.com
|
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
|
*
|
* @author Sergey Khabarov - sergeykhbr@gmail.com
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
* @brief Base Class interface declaration.
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
*/
|
*/
|
|
|
#ifndef __DEBUGGER_CLASS_H__
|
#ifndef __DEBUGGER_CLASS_H__
|
#define __DEBUGGER_CLASS_H__
|
#define __DEBUGGER_CLASS_H__
|
|
|
#include "iface.h"
|
#include <iface.h>
|
#include "iservice.h"
|
#include <iservice.h>
|
#include "api_core.h"
|
#include <api_core.h>
|
|
|
namespace debugger {
|
namespace debugger {
|
|
|
static const char *const IFACE_CLASS = "IClass";
|
static const char *const IFACE_CLASS = "IClass";
|
|
|
class IClass : public IFace {
|
class IClass : public IFace {
|
public:
|
public:
|
IClass(const char *class_name)
|
explicit IClass(const char *class_name)
|
: IFace(IFACE_CLASS), class_name_(class_name) {
|
: IFace(IFACE_CLASS) {
|
|
class_name_.make_string(class_name);
|
RISCV_register_class(static_cast<IClass *>(this));
|
RISCV_register_class(static_cast<IClass *>(this));
|
listInstances_ = AttributeType(Attr_List);
|
listInstances_ = AttributeType(Attr_List);
|
}
|
}
|
virtual ~IClass() {
|
virtual ~IClass() {
|
for (unsigned i = 0; i < listInstances_.size(); i++) {
|
for (unsigned i = 0; i < listInstances_.size(); i++) {
|
Line 45... |
Line 55... |
tmp = static_cast<IService *>(listInstances_[i].to_iface());
|
tmp = static_cast<IService *>(listInstances_[i].to_iface());
|
tmp->predeleteService();
|
tmp->predeleteService();
|
}
|
}
|
}
|
}
|
|
|
virtual const char *getClassName() { return class_name_; }
|
virtual const char *getClassName() { return class_name_.to_string(); }
|
|
|
virtual IService *getInstance(const char *name) {
|
virtual IService *getInstance(const char *name) {
|
IService *ret = NULL;
|
IService *ret = NULL;
|
for (unsigned i = 0; i < listInstances_.size(); i++) {
|
for (unsigned i = 0; i < listInstances_.size(); i++) {
|
ret = static_cast<IService *>(listInstances_[i].to_iface());
|
ret = static_cast<IService *>(listInstances_[i].to_iface());
|
Line 75... |
Line 85... |
}
|
}
|
|
|
virtual const AttributeType *getInstanceList() { return &listInstances_; }
|
virtual const AttributeType *getInstanceList() { return &listInstances_; }
|
|
|
protected:
|
protected:
|
const char *class_name_;
|
AttributeType class_name_;
|
AttributeType listInstances_;
|
AttributeType listInstances_;
|
};
|
};
|
|
|
/**
|
/**
|
* @brief Unified macros of plugin class declaration.
|
* @brief Unified macros of plugin class declaration.
|