diff options
author | Viktor Mladenovski <viktor.mladenovski@stericsson.com> | 2011-05-20 14:10:59 +0200 |
---|---|---|
committer | Viktor Mladenovski <viktor.mladenovski@stericsson.com> | 2011-05-20 14:10:59 +0200 |
commit | f7e95217e936da34d7124aaced590692eb515923 (patch) | |
tree | 2d9ef4750a67d9d1dd3fe9180a4fef2929fad54b /source/LCDriverInterface.cpp |
Initial contribution of loader_communication
ST-Ericsson ID: 326913
ST-Ericsson FOSS-OUT ID: STETL-FOSS-OUT-10204
Change-Id: I171cfc2ee458a8a0a91a1916137d131f0f7ecee5
Diffstat (limited to 'source/LCDriverInterface.cpp')
-rw-r--r-- | source/LCDriverInterface.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/source/LCDriverInterface.cpp b/source/LCDriverInterface.cpp new file mode 100644 index 0000000..adda735 --- /dev/null +++ b/source/LCDriverInterface.cpp @@ -0,0 +1,55 @@ +/****************************************************************************** +* +* File name: LCDriverInterface.cpp +* Project: LoaderCommunicationDriver +* Language: Visual C++ +* Description: Interface class. +* +* +* Copyright (C) ST-Ericsson SA 2011 +* License terms: 3-clause BSD license +* +******************************************************************************/ + +#include "LCDriverInterface.h" + +CCriticalSectionObject CLCDriverInterface::InitializationCS; +CObjectList<CLCDriverMethods> CLCDriverInterface::ObjectList; + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// +CLCDriverInterface::CLCDriverInterface() +{ + isStarted = false; + m_pObject = NULL; + m_szObjectId[0] = '\0'; +} + +CLCDriverInterface::~CLCDriverInterface() +{ + CLockCS CsLock(InitializationCS); + + // Disconnect from the CLCDriverMethods object + if (m_pObject != NULL) { + if (ObjectList.Release(m_pObject) == 0) { + delete m_pObject; + m_pObject = NULL; + } + } +} + +CLCDriverMethods *CLCDriverInterface::FindObject(const char *interfaceId) +{ + return ObjectList.Find(interfaceId); +} + +void CLCDriverInterface::ReleaseObject(CLCDriverMethods *object) +{ + ObjectList.Release(object); +} + +int CLCDriverInterface::AddObject(CLCDriverMethods *object, const char *interfaceId) +{ + return ObjectList.Add(object, interfaceId); +} |