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

📄 errorbase.h

📁 good luck to everyone!
💻 H
字号:
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.							  */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */
/*----------------------------------------------------------------------------*/

#ifndef _ERROR_BASE_H
#define _ERROR_BASE_H

#include <VxWorks.h>
#include "ChipObject.h"
#include "Error.h"
#include  <semlib.h>
#include "Base.h"

/// Use this macro to set the error.
#define wpi_setError(errorBase, code)   ((errorBase).SetError((code), __FILE__, __LINE__))

/**
 * Base class for most objects.
 * ErrorBase is the base class for most objects since it holds the generated error
 * for that object. In addition, there is a single instance of a global error object
 */
class ErrorBase
{
//TODO: Consider initializing instance variables and cleanup in destructor
public:
	virtual ~ErrorBase();
	virtual Error& GetError();
	virtual const Error& GetError() const;
	virtual void SetError(Error::Code code, const char* filename, UINT32 lineNumber) const;
    virtual void ClearError();
    virtual bool StatusIsFatal() const;
    static Error& GetGlobalError();
protected:
    //  TODO: Get rid of status when rest of the code does not need it
    tRioStatusCode status;
	mutable Error error;
    static SEM_ID globalErrorMutex;
	static Error globalError;
	ErrorBase();
private:
	DISALLOW_COPY_AND_ASSIGN(ErrorBase);
};

#endif

⌨️ 快捷键说明

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