rtpkg 0.1.0
A ROS2 example package that contains the publisher and subscriber example of both C++ & Python, with the use of custom message.
Loading...
Searching...
No Matches
helper.hpp
1// Copyright 2021 Photon
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef RTPKG__HELPER_HPP_
16#define RTPKG__HELPER_HPP_
17
18#include <random>
19
20class rtpkg
21{
22public:
23 rtpkg();
24 ~rtpkg();
25
32 int getRand(int minD, int maxD);
33
39 bool checkPrime(int n);
40
46 float getPrimeRatio();
47
51 int getCount();
52
56 int getMin();
57
61 int getMax();
62
63private:
64 int numMin{10000};
65 int numMax{-1000};
66 int totalCount{0};
67 int totalPrime{0};
68 void setMin(int & mn);
69 void setMax(int & mx);
70};
71
72#endif // RTPKG__HELPER_HPP_
Definition helper.hpp:21
int getMin()
Function to get the smallest number generated.
Definition helper.cpp:71
float getPrimeRatio()
Function to get the ratio of the number of prime number generated over the total number of random num...
Definition helper.cpp:57
int getRand(int minD, int maxD)
Function to generate a random number.
Definition helper.cpp:21
int getMax()
Function to get the largest number generated.
Definition helper.cpp:76
bool checkPrime(int n)
Function to check whether the input number is a prime number.
Definition helper.cpp:38
int getCount()
Function to get the total number of random number generated.
Definition helper.cpp:66