Browse Source

Update doxygen properties in code.

tags/version/0.1.15
Kai Kretschmann 2 months ago
parent
commit
6c9e2cbf5e
4 changed files with 66 additions and 65 deletions
  1. 3
    22
      MeasureBase.cpp
  2. 34
    11
      MeasureBase.h
  3. 3
    24
      MeasureEntropy.cpp
  4. 26
    8
      MeasureEntropy.h

+ 3
- 22
MeasureBase.cpp View File

@@ -2,13 +2,9 @@
2 2
  * @file MeasureBase.h
3 3
  * @author Kai KRETSCHMANN
4 4
  *
5
- * @section LICENSE
5
+ * @license SPDX-License-Identifier: MIT
6 6
  *
7
- * SPDX-License-Identifier: MIT
8
- *
9
- * @section DESCRIPTION
10
- *
11
- * Base class for doing measurements.
7
+ * @brief Base class for doing measurements.
12 8
  *
13 9
  **/
14 10
 
@@ -23,34 +19,19 @@ using namespace std;
23 19
 
24 20
 namespace jastacry {
25 21
 
26
-/**
27
- * Constructor for base class.
28
- *
29
- * @param filename String by reference of file to read.
30
- *
31
- */
32 22
 MeasureBase::MeasureBase(const string& filename) : _filename(filename), _filesize(0) {
33 23
 	spdlog::debug("CTOR MeasureBase normal");
34 24
 	readFile();
35 25
 }
36 26
 
37
-/**
38
- * Getter function for filename.
39
- */
40 27
 std::string& MeasureBase::getFilename() {
41 28
 	return _filename;
42 29
 }
43
-/**
44
- * Getter function for filesize.
45
- */
30
+
46 31
 size_t MeasureBase::getFilesize() {
47 32
 	return _filesize;
48 33
 }
49 34
 
50
-/**
51
- * Main action to read the given file.
52
- * Child classes then can measure values out of it.
53
- */
54 35
 bool MeasureBase::readFile() {
55 36
 	ifstream file(_filename, ios::binary);
56 37
 	    if (file.fail()) {

+ 34
- 11
MeasureBase.h View File

@@ -2,13 +2,9 @@
2 2
  * @file MeasureBase.h
3 3
  * @author Kai KRETSCHMANN
4 4
  *
5
- * @section LICENSE
5
+ * @copyright SPDX-License-Identifier: MIT
6 6
  *
7
- * SPDX-License-Identifier: MIT
8
- *
9
- * @section DESCRIPTION
10
- *
11
- * Base class for doing measurements.
7
+ * @brief Base class for doing measurements.
12 8
  *
13 9
  **/
14 10
 
@@ -23,31 +19,58 @@
23 19
 namespace jastacry {
24 20
 
25 21
 /**
26
- * MeasureBase class.
22
+ * @brief MeasureBase class.
27 23
  */
28 24
 class MeasureBase {
29 25
 private:
26
+	/**
27
+	 * @brief Main action to read the given file. Child classes then can measure values out of it.
28
+	 * @return bool status of read action.
29
+	 */
30 30
 	bool readFile();
31 31
 	std::string _filename;
32 32
 	size_t _filesize;
33 33
 protected:
34 34
 	std::vector<unsigned char> _buffer; /*!< Buffer to read file into */
35
+
36
+	/**
37
+	 * @brief Getter function for filename.
38
+	 * @return String reference to file name.
39
+	 */
35 40
 	std::string& getFilename();
41
+
42
+	/**
43
+	 * @brief Getter function for file size.
44
+	 * @return size_t file size.
45
+	 */
36 46
 	size_t getFilesize();
47
+
37 48
 public:
38
-	explicit MeasureBase(const std::string& f);
49
+	/**
50
+	 * @brief Constructor for base class.
51
+	 *
52
+	 * @param filename [in] - String by reference of file to read.
53
+	 *
54
+	 */
55
+	explicit MeasureBase(const std::string& filename);
56
+
57
+	/**
58
+	 * @brief Destructor default implementation.
59
+	 */
39 60
 	virtual ~MeasureBase() = default;
40 61
 
41 62
 	/**
42
-	 * Abstract base function.
63
+	 * @brief Abstract base function.
43 64
 	 */
44 65
 	virtual void measure() = 0;
66
+
45 67
 	/**
46
-	 * Abstract base function.
68
+	 * @brief Abstract base function.
47 69
 	 */
48 70
 	virtual void printResult() = 0;
71
+
49 72
 	/**
50
-	 * Abstract base function.
73
+	 * @brief Abstract base function.
51 74
 	 */
52 75
 	virtual double getResult() = 0;
53 76
 };

+ 3
- 24
MeasureEntropy.cpp View File

@@ -2,15 +2,12 @@
2 2
  * @file MeasureEntropy.h
3 3
  * @author Kai KRETSCHMANN
4 4
  *
5
- * @section LICENSE
5
+ * @license SPDX-License-Identifier: MIT
6 6
  *
7
- * SPDX-License-Identifier: MIT
8
- *
9
- * @section DESCRIPTION
10
- *
11
- * Real entropy calculation class for doing measurements.
7
+ * @brief Real entropy calculation class for doing measurements.
12 8
  *
13 9
  **/
10
+
14 11
 #include <string>
15 12
 #include <map>
16 13
 #include <iostream>
@@ -24,27 +21,15 @@ using namespace std;
24 21
 
25 22
 namespace jastacry {
26 23
 
27
-/**
28
- * Constructor for class.
29
- *
30
- * @param filename String by reference of file to read.
31
- *
32
- */
33 24
 MeasureEntropy::MeasureEntropy(const string& f) :
34 25
 		MeasureBase(f), _infocontent(0.0) {
35 26
 	spdlog::debug("CTOR MeasureEntropy normal");
36 27
 }
37 28
 
38
-/**
39
- * Internal log function.
40
- */
41 29
 double MeasureEntropy::log2(const double number) {
42 30
 	return log(number) / log(2);
43 31
 }
44 32
 
45
-/**
46
- * Main measure function. Reads from file buffer and sets internal property to entropy value.
47
- */
48 33
 void MeasureEntropy::measure() {
49 34
 	char* data = (char*)_buffer.data();
50 35
 	std::string teststring(data, getFilesize());
@@ -58,16 +43,10 @@ void MeasureEntropy::measure() {
58 43
 	}
59 44
 }
60 45
 
61
-/**
62
- * Print entropy to logging.
63
- */
64 46
 void MeasureEntropy::printResult() {
65 47
 	spdlog::info("The information content of {} is {}", getFilename(), _infocontent);
66 48
 }
67 49
 
68
-/**
69
- * Return entropy as double.
70
- */
71 50
 double MeasureEntropy::getResult() {
72 51
 	spdlog::info("Return result of {}", _infocontent);
73 52
 	return _infocontent;

+ 26
- 8
MeasureEntropy.h View File

@@ -2,13 +2,9 @@
2 2
  * @file MeasureEntropy.h
3 3
  * @author Kai KRETSCHMANN
4 4
  *
5
- * @section LICENSE
5
+ * @copyright SPDX-License-Identifier: MIT
6 6
  *
7
- * SPDX-License-Identifier: MIT
8
- *
9
- * @section DESCRIPTION
10
- *
11
- * Real entropy calculation class for doing measurements.
7
+ * @brief Real entropy calculation class for doing measurements.
12 8
  *
13 9
  **/
14 10
 
@@ -21,18 +17,40 @@
21 17
 namespace jastacry {
22 18
 
23 19
 /**
24
- * MeasureBase class.
20
+ * @brief MeasureEntropy class.
25 21
  */
26 22
 class MeasureEntropy: public MeasureBase {
27 23
 private:
24
+	/**
25
+	 * @brief Internal log function.
26
+	 * @param number [in] - double to calculate log2 on.
27
+	 * @return double as result.
28
+	 */
28 29
 	double log2(const double number);
29 30
 	double _infocontent;
30 31
 public:
31
-	explicit MeasureEntropy(const std::string& f);
32
+	/**
33
+	 * @brief Constructor for class.
34
+	 *
35
+	 * @param filename [in] - String by reference of file to read.
36
+	 *
37
+	 */
38
+	explicit MeasureEntropy(const std::string& filename);
32 39
 	virtual ~MeasureEntropy() = default;
33 40
 
41
+	/**
42
+	 * @brief Main measure function. Reads from file buffer and sets internal property to entropy value.
43
+	 */
34 44
 	virtual void measure() override;
45
+
46
+	/**
47
+	 * @brief Print entropy to logging.
48
+	 */
35 49
 	virtual void printResult() override;
50
+
51
+	/**
52
+	 * @brief Return entropy as double.
53
+	 */
36 54
 	virtual double getResult() override;
37 55
 };
38 56
 

Loading…
Cancel
Save
Social stuff:
Mastodon