diff --git a/src/apps/debugger/ids/FunctionID.cpp b/src/apps/debugger/ids/FunctionID.cpp new file mode 100644 index 0000000000..b1c4ec19b4 --- /dev/null +++ b/src/apps/debugger/ids/FunctionID.cpp @@ -0,0 +1,36 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ + + +#include "FunctionID.h" + +#include "StringUtils.h" + + +FunctionID::FunctionID(const BString& idString) + : + fIDString(idString) +{ +} + + +FunctionID::~FunctionID() +{ +} + + +bool +FunctionID::operator==(const ObjectID& other) const +{ + const FunctionID* functionID = dynamic_cast(&other); + return functionID != NULL && fIDString == functionID->fIDString; +} + + +uint32 +FunctionID::ComputeHashValue() const +{ + return StringUtils::HashValue(fIDString); +} diff --git a/src/apps/debugger/ids/FunctionID.h b/src/apps/debugger/ids/FunctionID.h new file mode 100644 index 0000000000..82e469a61e --- /dev/null +++ b/src/apps/debugger/ids/FunctionID.h @@ -0,0 +1,29 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef FUNCTION_ID_H +#define FUNCTION_ID_H + + +#include + +#include "ObjectID.h" + + +class FunctionID : public ObjectID { +public: + FunctionID(const BString& idString); + virtual ~FunctionID(); + + virtual bool operator==(const ObjectID& other) const; + +protected: + virtual uint32 ComputeHashValue() const; + +private: + const BString fIDString; +}; + + +#endif // FUNCTION_ID_H diff --git a/src/apps/debugger/ids/FunctionParameterID.cpp b/src/apps/debugger/ids/FunctionParameterID.cpp new file mode 100644 index 0000000000..48fb6ab76e --- /dev/null +++ b/src/apps/debugger/ids/FunctionParameterID.cpp @@ -0,0 +1,13 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ + + +#include "FunctionParameterID.h" + + +FunctionParameterID::~FunctionParameterID() +{ +} + diff --git a/src/apps/debugger/ids/FunctionParameterID.h b/src/apps/debugger/ids/FunctionParameterID.h new file mode 100644 index 0000000000..689d5527b5 --- /dev/null +++ b/src/apps/debugger/ids/FunctionParameterID.h @@ -0,0 +1,18 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef FUNCTION_PARAMETER_ID_H +#define FUNCTION_PARAMETER_ID_H + + +#include "ObjectID.h" + + +class FunctionParameterID : public ObjectID { +public: + virtual ~FunctionParameterID(); +}; + + +#endif // FUNCTION_PARAMETER_ID_H diff --git a/src/apps/debugger/ids/LocalVariableID.cpp b/src/apps/debugger/ids/LocalVariableID.cpp new file mode 100644 index 0000000000..64d62c1800 --- /dev/null +++ b/src/apps/debugger/ids/LocalVariableID.cpp @@ -0,0 +1,13 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ + + +#include "LocalVariableID.h" + + +LocalVariableID::~LocalVariableID() +{ +} + diff --git a/src/apps/debugger/ids/LocalVariableID.h b/src/apps/debugger/ids/LocalVariableID.h new file mode 100644 index 0000000000..d77d6290d4 --- /dev/null +++ b/src/apps/debugger/ids/LocalVariableID.h @@ -0,0 +1,18 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef LOCAL_VARIABLE_ID_H +#define LOCAL_VARIABLE_ID_H + + +#include "ObjectID.h" + + +class LocalVariableID : public ObjectID { +public: + virtual ~LocalVariableID(); +}; + + +#endif // LOCAL_VARIABLE_ID_H diff --git a/src/apps/debugger/ids/ObjectID.cpp b/src/apps/debugger/ids/ObjectID.cpp new file mode 100644 index 0000000000..32b78f3299 --- /dev/null +++ b/src/apps/debugger/ids/ObjectID.cpp @@ -0,0 +1,19 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ + + +#include "ObjectID.h" + + +ObjectID::ObjectID() + : + fHashValue(0) +{ +} + + +ObjectID::~ObjectID() +{ +} diff --git a/src/apps/debugger/ids/ObjectID.h b/src/apps/debugger/ids/ObjectID.h new file mode 100644 index 0000000000..b1a79bb3cb --- /dev/null +++ b/src/apps/debugger/ids/ObjectID.h @@ -0,0 +1,46 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef OBJECT_ID_H +#define OBJECT_ID_H + + +#include + + +class ObjectID : public Referenceable { +public: + ObjectID(); + virtual ~ObjectID(); + + inline uint32 HashValue() const; + + virtual bool operator==(const ObjectID& other) const = 0; + inline bool operator!=(const ObjectID& other) const; + +protected: + virtual uint32 ComputeHashValue() const = 0; + +protected: + mutable uint32 fHashValue; +}; + + +uint32 +ObjectID::HashValue() const +{ + if (fHashValue == 0) + fHashValue = ComputeHashValue(); + return fHashValue; +} + + +bool +ObjectID::operator!=(const ObjectID& other) const +{ + return !(*this == other); +} + + +#endif // OBJECT_ID_H