Skip to content

Commit e9f974e

Browse files
committed
Release v0.8
2 parents c1f06c1 + c4b88d8 commit e9f974e

File tree

5 files changed

+15
-73
lines changed

5 files changed

+15
-73
lines changed

.appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ build_script:
3636
- if exist %BUILD_DIR% rmdir /S /Q %BUILD_DIR%
3737
- mkdir %BUILD_DIR%
3838
- cd %BUILD_DIR%
39-
- cmake .. -DCMAKE_BUILD_TYPE=%CONFIGURATION% -G "NMake Makefiles" -DBOOST_ROOT="C:\Libraries\boost_1_65_1" -DBoost_USE_STATIC_LIBS=ON
39+
- cmake .. -DCMAKE_BUILD_TYPE=%CONFIGURATION% -G "NMake Makefiles" -DBOOST_ROOT="C:/Libraries/boost_1_65_1" -DBoost_USE_STATIC_LIBS=ON
4040
- nmake
4141
- mkdir output.build
4242
- cd output.build

CMakeLists.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ option (DEMO1_NO_WARN_AS_ERR "Don't treat compilation warnings as errors." OFF)
1717
# is not provided and examples are not disabled.
1818

1919
if ("${COMMSDSL_TAG}" STREQUAL "")
20-
set(COMMSDSL_TAG "v2.0.2")
20+
set(COMMSDSL_TAG "v2.1")
2121
endif ()
2222

2323
if ("${COMMS_TAG}" STREQUAL "")
24-
set(COMMS_TAG "v1.3")
24+
set(COMMS_TAG "v2.0")
2525
endif ()
2626

27-
set (VERSION "0.7.2")
27+
set (VERSION "0.8")
2828

2929
set (COMMSDSL_TGT "commsdsl_tgt")
3030
if ("${COMMSDSL2COMMS}" STREQUAL "")
@@ -63,15 +63,12 @@ endif ()
6363

6464
set (schema_file "${CMAKE_SOURCE_DIR}/dsl/schema.xml")
6565
set (tmp_dir "${CMAKE_BINARY_DIR}/output.tmp")
66-
#set (code_input_dir "${CMAKE_SOURCE_DIR}/src")
6766

6867
if ("${OUTPUT_DIR}" STREQUAL "")
6968
set (OUTPUT_DIR "${CMAKE_BINARY_DIR}/output")
7069
endif ()
7170

7271

73-
#file (GLOB_RECURSE src_files ${code_input_dir})
74-
7572
set (extra_dep)
7673
if (TARGET ${COMMSDSL_TGT})
7774
set (extra_dep ${COMMSDSL_TGT})

examples/client/Client.cpp

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include "demo1/MsgId.h"
77
#include "comms/units.h"
8+
#include "comms/process.h"
89

910
namespace demo1
1011
{
@@ -328,38 +329,10 @@ void Client::waitForAck()
328329

329330
void Client::processInput()
330331
{
331-
std::size_t consumed = 0U;
332-
while (consumed < m_inputBuf.size()) {
333-
// Smart pointer to the message object.
334-
Frame::MsgPtr msgPtr;
335-
336-
// Get the iterator for reading
337-
auto begIter = comms::readIteratorFor<InputMsg>(&m_inputBuf[0] + consumed);
338-
auto iter = begIter;
339-
340-
// Do the read
341-
auto es = m_frame.read(msgPtr, iter, m_inputBuf.size() - consumed);
342-
if (es == comms::ErrorStatus::NotEnoughData) {
343-
break; // Not enough data in the buffer, stop processing
344-
}
345-
346-
if (es == comms::ErrorStatus::ProtocolError) {
347-
// Something is not right with the data, remove one character and try again
348-
std::cerr << "WARNING: Corrupted buffer" << std::endl;
349-
++consumed;
350-
continue;
351-
}
352-
353-
if (es == comms::ErrorStatus::Success) {
354-
assert(msgPtr); // If read is successful, msgPtr is expected to hold a valid pointer
355-
msgPtr->dispatch(*this); // Call appropriate handle() function
356-
}
357-
358-
// The iterator for reading has been advanced, update the difference
359-
consumed += std::distance(begIter, iter);
332+
if (!m_inputBuf.empty()) {
333+
auto consumed = comms::processAllWithDispatch(&m_inputBuf[0], m_inputBuf.size(), m_frame, *this);
334+
m_inputBuf.erase(m_inputBuf.begin(), m_inputBuf.begin() + consumed);
360335
}
361-
362-
m_inputBuf.erase(m_inputBuf.begin(), m_inputBuf.begin() + consumed);
363336
}
364337

365338
} // namespace client

examples/server/Session.cpp

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include "demo1/message/Ack.h"
88
#include "comms/units.h"
9+
#include "comms/process.h"
910

1011
namespace demo1
1112
{
@@ -349,39 +350,10 @@ void Session::terminateSession()
349350

350351
void Session::processInput()
351352
{
352-
std::size_t consumed = 0U;
353-
while (consumed < m_inputBuf.size()) {
354-
// Smart pointer to the message object.
355-
Frame::MsgPtr msgPtr;
356-
357-
// Get the iterator for reading
358-
auto begIter = comms::readIteratorFor<InputMsg>(&m_inputBuf[0] + consumed);
359-
auto iter = begIter;
360-
361-
// Do the read
362-
auto es = m_frame.read(msgPtr, iter, m_inputBuf.size() - consumed);
363-
if (es == comms::ErrorStatus::NotEnoughData) {
364-
break; // Not enough data in the buffer, stop processing
365-
}
366-
367-
if (es == comms::ErrorStatus::ProtocolError) {
368-
// Something is not right with the data, remove one character and try again
369-
std::cerr << "WARNING: Corrupted buffer" << std::endl;
370-
++consumed;
371-
continue;
372-
}
373-
374-
if (es == comms::ErrorStatus::Success) {
375-
assert(msgPtr); // If read is successful, msgPtr is expected to hold a valid pointer
376-
std::cout << "INFO: New message: " << msgPtr->name() << std::endl;
377-
msgPtr->dispatch(*this); // Call appropriate handle() function
378-
}
379-
380-
// The iterator for reading has been advanced, update the difference
381-
consumed += std::distance(begIter, iter);
353+
if (!m_inputBuf.empty()) {
354+
auto consumed = comms::processAllWithDispatch(&m_inputBuf[0], m_inputBuf.size(), m_frame, *this);
355+
m_inputBuf.erase(m_inputBuf.begin(), m_inputBuf.begin() + consumed);
382356
}
383-
384-
m_inputBuf.erase(m_inputBuf.begin(), m_inputBuf.begin() + consumed);
385357
}
386358

387359
void Session::sendAck(demo1::MsgId id)

script/appveyor_install.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" (
2323
exit -1
2424
)
2525

26-
set QTDIR_PREFIX=C:\Qt\%QT_VER%
26+
set QTDIR_PREFIX=C:/Qt/%QT_VER%
2727
IF "%PLATFORM%"=="x86" (
2828
set QTDIR_SUFFIX=
2929
) ELSE (
3030
set QTDIR_SUFFIX=_64
3131
)
3232

33-
set QTDIR=%QTDIR_PREFIX%\%QT_SUBDIR%%QTDIR_SUFFIX%
33+
set QTDIR=%QTDIR_PREFIX%/%QT_SUBDIR%%QTDIR_SUFFIX%
3434
IF NOT EXIST %QTDIR% (
3535
echo WARNING: %QTDIR% does not exist!!!
36-
set QTDIR=%QTDIR_PREFIX%\msvc2015%QTDIR_SUFFIX%
36+
set QTDIR=%QTDIR_PREFIX%/msvc2015%QTDIR_SUFFIX%
3737
)
3838

3939
echo Using Qt5 from %QTDIR%

0 commit comments

Comments
 (0)