eap::ui_context class for inter-process exchange introduced
This commit is contained in:
parent
386d852859
commit
191e4abd9c
@ -85,6 +85,7 @@
|
||||
<ClInclude Include="..\include\EAPXML.h" />
|
||||
<ClInclude Include="..\include\Method.h" />
|
||||
<ClInclude Include="..\include\Module.h" />
|
||||
<ClInclude Include="..\include\UIContext.h" />
|
||||
<ClInclude Include="..\src\StdAfx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -99,6 +100,7 @@
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\UIContext.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Events\build\Events.vcxproj">
|
||||
|
@ -32,6 +32,9 @@
|
||||
<ClInclude Include="..\include\Credentials.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\UIContext.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\StdAfx.cpp">
|
||||
@ -52,5 +55,8 @@
|
||||
<ClCompile Include="..\src\EAP.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\UIContext.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
103
lib/EAPBase/include/UIContext.h
Normal file
103
lib/EAPBase/include/UIContext.h
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
Copyright 2015-2017 Amebis
|
||||
Copyright 2016-2017 GÉANT
|
||||
|
||||
This file is part of GÉANTLink.
|
||||
|
||||
GÉANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GÉANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace eap
|
||||
{
|
||||
class ui_context;
|
||||
}
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Config.h"
|
||||
#include "Credentials.h"
|
||||
#include "Module.h"
|
||||
|
||||
#include "../../../include/Version.h"
|
||||
|
||||
|
||||
namespace eap
|
||||
{
|
||||
///
|
||||
/// \defgroup EAPBaseUICtx UI Context
|
||||
/// Back and front-end inter-process data exchange
|
||||
///
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// UI context
|
||||
///
|
||||
class ui_context : public config
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs context
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
/// \param[in] cfg Connection configuration
|
||||
/// \param[in] cred Connection credentials
|
||||
///
|
||||
ui_context(_In_ module &mod, _In_ config_connection &cfg, _In_ credentials_connection &cred);
|
||||
|
||||
///
|
||||
/// Copies context
|
||||
///
|
||||
/// \param[in] other Credentials to copy from
|
||||
///
|
||||
ui_context(_In_ const ui_context &other);
|
||||
|
||||
///
|
||||
/// Moves context
|
||||
///
|
||||
/// \param[in] other Credentials to move from
|
||||
///
|
||||
ui_context(_Inout_ ui_context &&other);
|
||||
|
||||
///
|
||||
/// Copies context
|
||||
///
|
||||
/// \param[in] other Credentials to copy from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
ui_context& operator=(_In_ const ui_context &other);
|
||||
|
||||
///
|
||||
/// Moves context
|
||||
///
|
||||
/// \param[in] other Configuration to move from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
ui_context& operator=(_Inout_ ui_context &&other);
|
||||
|
||||
/// \name BLOB management
|
||||
/// @{
|
||||
virtual void operator<<(_Inout_ cursor_out &cursor) const;
|
||||
virtual size_t get_pk_size() const;
|
||||
virtual void operator>>(_Inout_ cursor_in &cursor);
|
||||
/// @}
|
||||
|
||||
public:
|
||||
config_connection &m_cfg; ///< Connection configuration
|
||||
credentials_connection &m_cred; ///< Connection credentials
|
||||
};
|
||||
|
||||
/// @}
|
||||
}
|
@ -24,6 +24,7 @@
|
||||
#include "../include/Credentials.h"
|
||||
#include "../include/Method.h"
|
||||
#include "../include/Module.h"
|
||||
#include "../include/UIContext.h"
|
||||
|
||||
#include "../include/EAP.h"
|
||||
#include "../include/EAPXML.h"
|
||||
|
101
lib/EAPBase/src/UIContext.cpp
Normal file
101
lib/EAPBase/src/UIContext.cpp
Normal file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 GÉANT
|
||||
|
||||
This file is part of GÉANTLink.
|
||||
|
||||
GÉANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GÉANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace winstd;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::ui_context
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::ui_context::ui_context(_In_ module &mod, _In_ config_connection &cfg, _In_ credentials_connection &cred) :
|
||||
config(mod),
|
||||
m_cfg(cfg),
|
||||
m_cred(cred)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::ui_context::ui_context(_In_ const ui_context &other) :
|
||||
m_cfg (other.m_cfg ),
|
||||
m_cred(other.m_cred),
|
||||
config(other )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::ui_context::ui_context(_Inout_ ui_context &&other) :
|
||||
m_cfg ( other.m_cfg ),
|
||||
m_cred( other.m_cred ),
|
||||
config(std::move(other ))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::ui_context& eap::ui_context::operator=(_In_ const ui_context &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Copy context within same configuration only!
|
||||
assert(std::addressof(m_cred) == std::addressof(other.m_cred)); // Copy context within same credentials only!
|
||||
(config&)*this = other;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
eap::ui_context& eap::ui_context::operator=(_Inout_ ui_context &&other)
|
||||
{
|
||||
if (this != &other) {
|
||||
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Move context within same configuration only!
|
||||
assert(std::addressof(m_cred) == std::addressof(other.m_cred)); // Move context within same credentials only!
|
||||
(config&)*this = std::move(other);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void eap::ui_context::operator<<(_Inout_ cursor_out &cursor) const
|
||||
{
|
||||
config::operator<<(cursor);
|
||||
cursor << m_cfg ;
|
||||
cursor << m_cred;
|
||||
}
|
||||
|
||||
|
||||
size_t eap::ui_context::get_pk_size() const
|
||||
{
|
||||
return
|
||||
config::get_pk_size() +
|
||||
pksizeof(m_cfg ) +
|
||||
pksizeof(m_cred);
|
||||
}
|
||||
|
||||
|
||||
void eap::ui_context::operator>>(_Inout_ cursor_in &cursor)
|
||||
{
|
||||
config::operator>>(cursor);
|
||||
cursor >> m_cfg ;
|
||||
cursor >> m_cred;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user