cisst-saw
Toggle main menu visibility
Loading...
Searching...
No Matches
tmp
cisst-saw
cisst
cisstCommon
cmnRequiresDeepCopy.h
Go to the documentation of this file.
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3
4
/*
5
Author(s): Anton Deguet
6
Created on: 2009-11-17
7
8
(C) Copyright 2009-2021 Johns Hopkins University (JHU), All Rights Reserved.
9
10
--- begin cisst license - do not edit ---
11
12
This software is provided "as is" under an open source license, with
13
no warranty. The complete license can be found in license.txt and
14
http://www.cisst.org/cisst/license.txt.
15
16
--- end cisst license ---
17
18
*/
19
20
26
#pragma once
27
28
#ifndef _cmnRequiresDeepCopy_h
29
#define _cmnRequiresDeepCopy_h
30
31
#include <
cisstCommon/cmnPortability.h
>
32
#include <
cisstCommon/cmnThrow.h
>
33
38
template
<
class
_elementType>
39
bool
cmnRequiresDeepCopy
(
void
) {
40
return
true
;
41
}
42
46
template
<>
inline
bool
cmnRequiresDeepCopy<float>
(
void
) {
return
false
; }
47
template
<>
inline
bool
cmnRequiresDeepCopy<double>
(
void
) {
return
false
; }
48
template
<>
inline
bool
cmnRequiresDeepCopy<long double>
(
void
) {
return
false
; }
49
template
<>
inline
bool
cmnRequiresDeepCopy<bool>
(
void
) {
return
false
; }
50
template
<>
inline
bool
cmnRequiresDeepCopy<char>
(
void
) {
return
false
; }
51
template
<>
inline
bool
cmnRequiresDeepCopy<unsigned char>
(
void
) {
return
false
; }
52
template
<>
inline
bool
cmnRequiresDeepCopy<short>
(
void
) {
return
false
; }
53
template
<>
inline
bool
cmnRequiresDeepCopy<unsigned short>
(
void
) {
return
false
; }
54
template
<>
inline
bool
cmnRequiresDeepCopy<int>
(
void
) {
return
false
; }
55
template
<>
inline
bool
cmnRequiresDeepCopy<unsigned int>
(
void
) {
return
false
; }
56
template
<>
inline
bool
cmnRequiresDeepCopy<long long int>
(
void
) {
return
false
; }
57
template
<>
inline
bool
cmnRequiresDeepCopy<unsigned long long int>
(
void
) {
return
false
; }
59
60
#include <string.h>
// for memcpy
61
template
<
class
_elementType>
62
void
cmnMemcpy
(_elementType * destination,
const
_elementType * source,
63
const
size_t
size
) {
64
memcpy(
reinterpret_cast<
void
*
>
(destination),
reinterpret_cast<
const
void
*
>
(source),
size
);
65
}
66
67
#include <string>
// for template specialization
68
template
<>
inline
void
cmnMemcpy<std::string>
(std::string *,
const
std::string *,
size_t
) {
69
cmnThrow
(
"cmnMemcpy should not be called with std::string"
);
70
}
71
72
#endif
// _cmnRequiresDeepCopy_h
cmnPortability.h
Portability across compilers and operating systems tools.
cmnMemcpy< std::string >
void cmnMemcpy< std::string >(std::string *, const std::string *, size_t)
Definition
cmnRequiresDeepCopy.h:68
cmnRequiresDeepCopy
bool cmnRequiresDeepCopy(void)
Definition
cmnRequiresDeepCopy.h:39
cmnMemcpy
void cmnMemcpy(_elementType *destination, const _elementType *source, const size_t size)
Definition
cmnRequiresDeepCopy.h:62
cmnThrow.h
Declaration of the template function cmnThrow.
cmnThrow
void cmnThrow(const _exceptionType &except, cmnLogLevel lod=CMN_LOG_LEVEL_INIT_ERROR)
Definition
cmnThrow.h:76
size
size_type size(void) const
Definition
vctDynamicConstMatrixBase.h:228
Generated by
1.18.0