-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
1,478 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
add_library(common STATIC | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/edge.cpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/helpers.cpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/node.cpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/noise.cpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/tree.cpp | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/include/Common/block.h | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/include/Common/cxxpool.h | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/include/Common/edge.h | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/include/Common/gaussiannoise.h | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/include/Common/helpers.h | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/include/Common/link.h | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/include/Common/node.h | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/include/Common/noise.h | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/include/Common/threadpool.h | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/include/Common/tree.h | ||
) | ||
|
||
target_include_directories(common PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) | ||
target_include_directories(common PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/Common) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BLOCK_H | ||
#define BLOCK_H | ||
|
||
#include "link.h" | ||
|
||
template <typename typeIn, typename typeOut> | ||
class Block | ||
{ | ||
public: | ||
/** | ||
* @brief Block Block class constructor | ||
*/ | ||
Block(); | ||
|
||
/** | ||
* @brief setInputLink assign an input link to block | ||
* @param l constant pointer to link instance | ||
*/ | ||
void setInputLink(Link<typeIn>* const l); | ||
|
||
/** | ||
* @brief setOutLink assign an output link to block | ||
* @param l constant pouinter to link instance | ||
*/ | ||
void setOutLink(Link<typeOut>* const l); | ||
|
||
/** | ||
* @brief update virtual method. Derived class overrides this method | ||
*/ | ||
virtual void update() = 0; | ||
protected: | ||
virtual ~Block() {} | ||
Link<typeIn>* inputLink; | ||
Link<typeOut>* outputLink; | ||
|
||
/** | ||
* @brief read Getter method for reading the input link | ||
* @return Returns input link value | ||
*/ | ||
typeIn read(); | ||
|
||
/** | ||
* @brief write Setter method for writing to the output link | ||
* @param v Value to write | ||
*/ | ||
void write(const typeOut& v); | ||
}; | ||
|
||
template<typename typeIn, typename typeOut> | ||
Block<typeIn, typeOut>::Block() | ||
{ | ||
|
||
} | ||
|
||
template<typename typeIn, typename typeOut> | ||
void Block<typeIn, typeOut>::setInputLink(Link<typeIn> * const l) | ||
{ | ||
inputLink = l; | ||
} | ||
|
||
template<typename typeIn, typename typeOut> | ||
void Block<typeIn, typeOut>::setOutLink(Link<typeOut> * const l) | ||
{ | ||
outputLink = l; | ||
} | ||
|
||
template<typename typeIn, typename typeOut> | ||
typeIn Block<typeIn, typeOut>::read() | ||
{ | ||
return inputLink->readValue(); | ||
} | ||
|
||
template<typename typeIn, typename typeOut> | ||
void Block<typeIn, typeOut>::write(const typeOut& v) | ||
{ | ||
outputLink->setValue(v); | ||
} | ||
|
||
#endif // BLOCK_H |
Oops, something went wrong.