cisst-saw
Loading...
Searching...
No Matches
vctStoreBackUnaryOperations.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
6 Author(s): Ofri Sadowsky, Anton Deguet
7 Created on: 2003-08-18
8
9 (C) Copyright 2003-2007 Johns Hopkins University (JHU), All Rights
10 Reserved.
11
12--- begin cisst license - do not edit ---
13
14This software is provided "as is" under an open source license, with
15no warranty. The complete license can be found in license.txt and
16http://www.cisst.org/cisst/license.txt.
17
18--- end cisst license ---
19*/
20
21#pragma once
22#ifndef _vctStoreBackUnaryOperations_h
23#define _vctStoreBackUnaryOperations_h
24
29
55template<class _inputOutputElementType>
57{
58 public:
59 typedef _inputOutputElementType InputOutputElementType;
60
65 class MakeAbs {
66 public:
72 return (inputOutput = (inputOutput > InputOutputElementType(0))
73 ?
74 InputOutputElementType(inputOutput)
75 :
76 InputOutputElementType(-inputOutput));
77 }
78 };
79
85 public:
91 return (inputOutput = InputOutputElementType(-inputOutput));
92 }
93 };
94
99 class MakeFloor {
100 public:
102 return (inputOutput = InputOutputElementType( floor((double)inputOutput) ));
103 }
104 };
105
110 class MakeCeil {
111 public:
113 return (inputOutput = InputOutputElementType( ceil((double)inputOutput) ));
114 }
115 };
116
117
118};
119
120
121#endif // _vctStoreBackUnaryOperations_h
122
Returns the absolute value of the input as an OutputType object.
Definition vctStoreBackUnaryOperations.h:65
static InputOutputElementType Operate(InputOutputElementType &inputOutput)
Definition vctStoreBackUnaryOperations.h:71
Returns the ceiling of the input, that is, the smallest integer greater-than or equal to the input,...
Definition vctStoreBackUnaryOperations.h:110
static InputOutputElementType Operate(InputOutputElementType &inputOutput)
Definition vctStoreBackUnaryOperations.h:112
Returns the floor of the input, that is, the largest integer less-than or equal to the input,...
Definition vctStoreBackUnaryOperations.h:99
static InputOutputElementType Operate(InputOutputElementType &inputOutput)
Definition vctStoreBackUnaryOperations.h:101
Returns the negation of the input as an OutputType object.
Definition vctStoreBackUnaryOperations.h:84
static InputOutputElementType Operate(InputOutputElementType &inputOutput)
Definition vctStoreBackUnaryOperations.h:90
Define store back unary operations on an object as classes.
Definition vctStoreBackUnaryOperations.h:57
_inputOutputElementType InputOutputElementType
Definition vctStoreBackUnaryOperations.h:59