STE-Industries: utilities testing
|
#include "Graphic.h"
#include "Bitmap.h"
#include "RandomGenerator.h"
#include "FileException.h"
#include "IntegerException.h"
#include "FloatException.h"
#include "NameException.h"
#include "ParameterDescriptor.h"
#include "NumericParameterDescriptor.h"
#include "EnumeratedParameterDescriptor.h"
#include "Thread.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
Go to the source code of this file.
Functions | |
static void | Application (const char *InputPathname, const char *OutputPathname, const Bitmap::CorrectionParameters &Parameters) noexcept(false) |
int | main (int argc, char *argv[]) |
static void | Randomize (const Bitmap::CorrectionParameters &Parameters, Bitmap &CurrentBitmap) noexcept |
static void | Usage (void) noexcept(false) |
static void | WriteProperties (const Bitmap &CurrentBitmap, const char *Path) noexcept(false) |
Variables | |
static constexpr const char * | BITS_PER_PIXEL_FORMAT |
static constexpr const char * | CORRECTING_MESSAGE |
static const Bitmap::CorrectionParameters | DefaultParameters |
const ParameterDescriptor *const | DescriptorTable [] |
static constexpr const char * | END_CORRECTION_FORMAT |
static constexpr const char * | END_READING_FORMAT |
static constexpr const char * | END_WRITING_FORMAT |
static constexpr const char * | FILE_SIZE_FORMAT = "File size = %lu\n" |
static constexpr const char * | IMAGE_SIZE_FORMAT |
static constexpr const char * | INVALID_OPTION_FORMAT |
static constexpr unsigned int | MAJOR_VERSION_NUMBER = 1 |
static constexpr unsigned int | MINOR_VERSION_NUMBER = 1 |
static constexpr const char *const | OpenWriteText = "w" |
static constexpr const char * | READING_FORMAT = "Reading %s\n" |
static constexpr const char * | RESOLUTION_FORMAT |
static constexpr const char * | USAGE_FORMAT |
static constexpr const char * | VERSION_FORMAT |
static constexpr const char * | WRITING_FORMAT = "Writing %s\n" |
|
staticnoexcept |
InputPathName | Pointer to the string containing the pathname of the input bitmap file. |
OutputPathName | Pointer to the string containing the pathname of the output bitmap file. |
Parameters | Reference to the struct containing the correction parameters. |
FileExceptionType::FILE_OPEN_ERROR | If an error occurs while opening the input or output bitmap file. |
FileExceptionType::FILE_SEEK_ERROR | If an error occurs while seeking the input bitmap file. |
FileExceptionType::FILE_READ_ERROR | If an error occurs while reading the input bitmap file. |
FileExceptionType::FILE_WRITE_ERROR | If an error occurs while writing the output bitmap file. |
FileExceptionType::FILE_CLOSE_ERROR | If an error occurs while closing the input or output bitmap file. |
IntegerExceptionType::INVALID_FILE_SIZE | If the bitmap file size in the header of the bitmap file is not equal to the actual file size. |
IntegerExceptionType::INVALID_BITMAP_OFFSET | If the bitmap offset in the header of the bitmap file is not equal to HEADER_SIZE + DIB_HEADER_SIZE. |
IntegerExceptionType::INVALID_DIB_HEADER_SIZE | If the DIB header size in the header of the bitmap file is not equal to DIB_HEADER_SIZE. |
IntegerExceptionType::INVALID_IMAGE_WIDTH | If the image width in the bitmap file is 0 or greater than MAXIMUM_WIDTH. |
IntegerExceptionType::INVALID_COLOR_PLANES | If the number of color planes in the bitmap file is not NUMBER_OF_COLOR_PLANES. |
IntegerExceptionType::INVALID_BITS_PER_PIXEL | If the number of bits per pixel in the bitmap file is not NUMBER_OF_COLORS * CHAR_BIT. |
IntegerExceptionType::INVALID_COMPRESSION | If the value of compression in the bitmap file is not VALID_COMPRESSION. |
IntegerExceptionType::INVALID_IMAGE_SIZE | If the image size in the bitmap file is not valid. |
IntegerExceptionType::INVALID_NUMBER_OF_COLORS | If the number of color in the bitmap file is not zero. |
IntegerExceptionType::INVALID_NUMBER_OF_IMPORTANT_COLORS | If the number of important colors in the bitmap file is not zero. |
IntegerExceptionType::INVALID_NUMBER_OF_TERMITES | If the number of termites is not a valid number, it is 0 or greater than MAXIMUM_NUMBER_OF_TERMITES. |
IntegerExceptionType::INVALID_NUMBER_OF_STEPS | If the number of steps is not a valid number, it is 0 or greater than MAXIMUM_NUMBER_OF_STEPS. |
FloatExceptionType::INVALID_REPULSION_STEP | If the repulsion step is not a valid number, it is less than 0 or greater than 1. |
FloatExceptionType::INVALID_ALPHA | If Alpha is is not a valid number, it less than 0 or greater than 1. |
FloatExceptionType::INVALID_BETA | If Beta is is not a valid number, it less than 0 or greater than 1. |
Definition at line 435 of file Main.cpp.
References GraphicSpace::Bitmap::Correct(), CORRECTING_MESSAGE, END_CORRECTION_FORMAT, END_READING_FORMAT, END_WRITING_FORMAT, GraphicSpace::FILE_WRITE_ERROR, Randomize(), GraphicSpace::Bitmap::ReadFile(), READING_FORMAT, STANDARD_OUTPUT, GraphicSpace::Bitmap::WriteFile(), WriteProperties(), and WRITING_FORMAT.
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
argc | Number of command line arguments. |
argv | Array of command line arguments. |
None. |
Definition at line 493 of file Main.cpp.
References Application(), DefaultParameters, DescriptorTable, GraphicSpace::ParameterDescriptor::EQUAL_CHARACTER, GraphicSpace::FILE_WRITE_ERROR, GraphicSpace::Thread::Finalize(), IgnoreValue, GraphicSpace::Thread::Initialize(), INVALID_OPTION_FORMAT, MAJOR_VERSION_NUMBER, MINOR_VERSION_NUMBER, NumberOfElements, STANDARD_OUTPUT, Usage(), VERSION_FORMAT, and GraphicSpace::Exception::Write().
|
staticnoexcept |
Parameters | Reference to the struct containing the correction parameters. |
CurrentBitmap | Reference to the Bitmap object that will correct the image. |
None. |
Definition at line 187 of file Main.cpp.
References DefaultParameters, GraphicSpace::RandomGenerator::NUMBER_OF_GENERATORS, and NumberOfElements.
Referenced by Application().
|
staticnoexcept |
FileExceptionType::FILE_WRITE_ERROR | If an error occurs while writing the string. |
Definition at line 317 of file Main.cpp.
References DefaultParameters, DescriptorTable, GraphicSpace::FILE_WRITE_ERROR, NumberOfElements, STANDARD_OUTPUT, and USAGE_FORMAT.
Referenced by main().
|
staticnoexcept |
CurrentBitmap | Reference to the bitmap. |
Path | Pathname of the file. |
FileExceptionType::FILE_OPEN_ERROR | If an error occurs while opening the file. |
FileExceptionType::FILE_WRITE_ERROR | If an error occurs while writing the file. |
FileExceptionType::FILE_CLOSE_ERROR | If an error occurs while closing the file. |
Definition at line 269 of file Main.cpp.
References BITS_PER_PIXEL_FORMAT, GraphicSpace::Bitmap::DIB_HEADER_SIZE, GraphicSpace::FILE_CLOSE_ERROR, GraphicSpace::FILE_OPEN_ERROR, FILE_SIZE_FORMAT, GraphicSpace::FILE_WRITE_ERROR, GraphicSpace::Bitmap::HEADER_SIZE, IMAGE_SIZE_FORMAT, OpenWriteText, and RESOLUTION_FORMAT.
Referenced by Application().
|
staticconstexpr |
Format string used to write the number of bits per pixel of the bitmap.
Definition at line 44 of file Main.cpp.
Referenced by WriteProperties().
|
staticconstexpr |
Message that declares that image correction started.
Definition at line 87 of file Main.cpp.
Referenced by Application().
|
static |
Correction parameters, initialized with default values.
Definition at line 109 of file Main.cpp.
Referenced by main(), GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE >::PrintUsage(), GraphicSpace::EnumeratedParameterDescriptor< ENUMERATED_TYPE >::PrintUsage(), Randomize(), and Usage().
DescriptorTable |
Table of descriptors of correction parameters.
|
staticconstexpr |
Format string used to write the message that declares that the correction is terminated.
Definition at line 93 of file Main.cpp.
Referenced by Application().
|
staticconstexpr |
Format string used to write the message that declares that reading the input file is terminated.
Definition at line 82 of file Main.cpp.
Referenced by Application().
|
staticconstexpr |
Format string used to write the message that declares that writing the output file is terminated.
Definition at line 104 of file Main.cpp.
Referenced by Application().
|
staticconstexpr |
Format string used to write the file size of the bitmap.
Definition at line 49 of file Main.cpp.
Referenced by WriteProperties().
|
staticconstexpr |
Format string used to write the width and height of the bitmap.
Definition at line 38 of file Main.cpp.
Referenced by WriteProperties().
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
String used to specify text write only mode when opening a file.
Definition at line 34 of file Main.cpp.
Referenced by WriteProperties().
|
staticconstexpr |
Format string used to write the message that declares that reading the input file is in progress.
Definition at line 77 of file Main.cpp.
Referenced by Application().
|
staticconstexpr |
Format string used to write the horizontal and vertical resolution of the bitmap.
Definition at line 54 of file Main.cpp.
Referenced by WriteProperties().
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
Format string used to write the message that declares that writing the output file is in progress.
Definition at line 99 of file Main.cpp.
Referenced by Application().