0001-Fix-compilation-on-windows-again.patch

J. Wienke, 12/18/2012 02:52 PM

Download (8.16 KB)

View differences:

src/rsb/converter/Converter.h
146 146
    }
147 147
};
148 148

  
149
RSB_EXPIMP template class RSB_EXPORT Converter<std::string>;
150

  
149 151
}
150 152
}
src/rsb/converter/ProtocolBufferConverter.h
35 35
#include "Converter.h"
36 36
#include "rsb/rsbexports.h"
37 37

  
38
#if defined(RSB_IMPORT_TEMPLATES)
39
template class __declspec(dllimport) rsb::converter::Converter<std::string>;
40
#endif
41

  
42 38
namespace rsb {
43 39
namespace converter {
44 40

  
src/rsb/rsbexports.h.in
37 37
    #else
38 38
        #define RSB_EXPORT __declspec(dllimport)
39 39
        #define RSB_EXPIMP extern
40
        #define RSB_IMPORT_TEMPLATES
41 40
    #endif
42 41
#else
43 42
    #define RSB_EXPORT
43
    #define RSB_EXPIMP
44 44
#endif
45 45

  
46 46
#endif /* RSBEXPORTS_H_ */
test/CMakeLists.txt
65 65
                      rsb/converter/PredicateConverterListTest.cpp
66 66
                      rsb/converter/ProtocolBufferConverterLinkingTest.cpp
67 67
                      rsb/converter/ProtocolBufferConverterTest.cpp
68
                      rsb/converter/TestConverter.cpp
69
                      rsb/converter/TestConverter.h
70
                      rsb/converter/TestConverterTest.cpp
68 71
                      rsb/eventprocessing/ParallelEventReceivingStrategyTest.cpp
69 72
                      rsb/util/MD5Test.cpp
70 73
                      rsb/transport/FactoryTest.cpp)
test/rsb/converter/TestConverter.cpp
1
/* ============================================================
2
 *
3
 * This file is a part of the rsb-cpp project.
4
 *
5
 * Copyright (C) 2012 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
6
 *
7
 * This file may be licensed under the terms of the
8
 * GNU Lesser General Public License Version 3 (the ``LGPL''),
9
 * or (at your option) any later version.
10
 *
11
 * Software distributed under the License is distributed
12
 * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
13
 * express or implied. See the LGPL for the specific language
14
 * governing rights and limitations.
15
 *
16
 * You should have received a copy of the LGPL along with this
17
 * program. If not, go to http://www.gnu.org/licenses/lgpl.html
18
 * or write to the Free Software Foundation, Inc.,
19
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
 *
21
 * The development of this software was supported by:
22
 *   CoR-Lab, Research Institute for Cognition and Robotics
23
 *     Bielefeld University
24
 *
25
 * ============================================================ */
26

  
27
#include "TestConverter.h"
28

  
29
TestConverter::TestConverter() :
30
        rsb::converter::Converter<std::string>("foo", "bar", true) {
31
}
32

  
33
TestConverter::~TestConverter() {
34
}
35

  
36
std::string TestConverter::serialize(const rsb::AnnotatedData& /*data*/,
37
        std::string& /*wire*/) {
38
    return "";
39
}
40

  
41
rsb::AnnotatedData TestConverter::deserialize(const std::string& /*wireSchema*/,
42
        const std::string& /*wire*/) {
43
    return std::make_pair("", boost::shared_ptr<void>());
44
}
test/rsb/converter/TestConverter.h
1
/* ============================================================
2
 *
3
 * This file is a part of the rsb-cpp project.
4
 *
5
 * Copyright (C) 2012 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
6
 *
7
 * This file may be licensed under the terms of the
8
 * GNU Lesser General Public License Version 3 (the ``LGPL''),
9
 * or (at your option) any later version.
10
 *
11
 * Software distributed under the License is distributed
12
 * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
13
 * express or implied. See the LGPL for the specific language
14
 * governing rights and limitations.
15
 *
16
 * You should have received a copy of the LGPL along with this
17
 * program. If not, go to http://www.gnu.org/licenses/lgpl.html
18
 * or write to the Free Software Foundation, Inc.,
19
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
 *
21
 * The development of this software was supported by:
22
 *   CoR-Lab, Research Institute for Cognition and Robotics
23
 *     Bielefeld University
24
 *
25
 * ============================================================ */
26

  
27
#pragma once
28

  
29
#include "rsb/converter/Converter.h"
30

  
31
/**
32
 * This converter is compiled into the unit tests to test windows compilation
33
 * issues with the templatized Converter base class.
34
 *
35
 * @ref https://code.cor-lab.org/issues/1285
36
 * @author jwienke
37
 */
38
class TestConverter: public rsb::converter::Converter<std::string> {
39
public:
40
    TestConverter();
41
    virtual ~TestConverter();
42

  
43
    virtual std::string serialize(const rsb::AnnotatedData& data,
44
            std::string& wire);
45

  
46
    virtual rsb::AnnotatedData deserialize(const std::string& wireSchema,
47
            const std::string& wire);
48

  
49
};
50

  
test/rsb/converter/TestConverterTest.cpp
1
/* ============================================================
2
 *
3
 * This file is part of the RSB project
4
 *
5
 * Copyright (C) 2012 Johannes Wienke <jwienke@techfak.uni-bielefeld.de>
6
 *
7
 * This file may be licensed under the terms of the
8
 * GNU Lesser General Public License Version 3 (the ``LGPL''),
9
 * or (at your option) any later version.
10
 *
11
 * Software distributed under the License is distributed
12
 * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
13
 * express or implied. See the LGPL for the specific language
14
 * governing rights and limitations.
15
 *
16
 * You should have received a copy of the LGPL along with this
17
 * program. If not, go to http://www.gnu.org/licenses/lgpl.html
18
 * or write to the Free Software Foundation, Inc.,
19
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
 *
21
 * The development of this software was supported by:
22
 *   CoR-Lab, Research Institute for Cognition and Robotics
23
 *     Bielefeld University
24
 *
25
 * ============================================================ */
26

  
27
#include <gtest/gtest.h>
28
#include <gmock/gmock.h>
29

  
30
#include "TestConverter.h"
31

  
32
using namespace std;
33
using namespace rsb;
34
using namespace rsb::converter;
35
using namespace testing;
36

  
37
TEST(TestConverterTest, testCompilation)
38
{
39
    TestConverter();
40
}
0
-