1
0

」 feat: finished ex03

This commit is contained in:
2025-04-03 16:07:05 +02:00
parent bb8d13b9ed
commit bd578ea11e
17 changed files with 811 additions and 5 deletions

89
ex03/AForm.cpp Normal file
View File

@ -0,0 +1,89 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* AForm.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/09 17:38:19 by adjoly #+# #+# */
/* Updated: 2025/04/03 14:33:17 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "AForm.hpp"
#include "Bureaucrat.hpp"
AForm::AForm(void) : _name(""), _signed(false), _minForSign(1), _minForExec(1) {
_log("", "AForm", "", "default constructor called");
}
AForm::AForm(std::string name, uint8_t minForSign, uint8_t minForExec)
: _name(name), _signed(false), _minForSign(minForSign),
_minForExec(minForExec) {
_log("", "AForm", "", "constructor called");
_gradeCheck();
}
AForm::AForm(const AForm &f)
: _name(f.getName()), _signed(f.getSigned()),
_minForSign(f.getMinForSign()), _minForExec(f.getMinForExec()) {
_log("", "AForm", "", "copy constructor called");
_gradeCheck();
}
AForm::~AForm(void) { _log("", "AForm", "", "destructor called"); }
AForm &AForm::operator=(const AForm &f) {
if (this == &f)
return *this;
_name = f.getName();
_signed = f.getSigned();
return *this;
}
const char *AForm::GradeTooHighException::what() const throw() {
return ("grade is too high");
}
const char *AForm::GradeTooLowException::what() const throw() {
return ("grade is too low");
}
const char *AForm::NotSigned::what() const throw() {
return ("not yet signed");
}
std::string AForm::getName(void) const { return _name; }
bool AForm::getSigned(void) const { return _signed; }
uint8_t AForm::getMinForSign(void) const { return _minForSign; }
uint8_t AForm::getMinForExec(void) const { return _minForExec; }
void AForm::beSigned(Bureaucrat b) {
if (_minForSign < b.getGrade()) {
throw GradeTooLowException();
}
_signed = true;
}
void AForm::execute(const Bureaucrat &b) const {
if (_signed == false) {
throw NotSigned();
}
if (b.getGrade() > _minForExec) {
throw GradeTooLowException();
}
_exec(b);
}
void AForm::_gradeCheck(void) const {
if (_minForExec < MAXGRADE || _minForSign < MAXGRADE)
throw GradeTooHighException();
if (_minForExec > MINGRADE || _minForExec > MINGRADE)
throw GradeTooLowException();
}
std::ostream &operator<<(std::ostream &os, AForm &val) {
os << "AForm: " << val.getName()
<< ", minGrade to sign: " << val.getMinForSign()
<< ", min grade to execute: " << val.getMinForExec() << std::endl;
return (os);
}

64
ex03/AForm.hpp Normal file
View File

@ -0,0 +1,64 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* AForm.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/08 20:10:59 by adjoly #+# #+# */
/* Updated: 2025/04/03 13:50:38 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include <string>
void _log(std::string emoji, std::string what, std::string who,
std::string str);
typedef unsigned char uint8_t;
#include "Bureaucrat.hpp"
class AForm {
public:
AForm(void);
AForm(std::string name, uint8_t minForSign, uint8_t minForExec);
AForm(const AForm &);
virtual ~AForm(void);
AForm &operator=(const AForm &);
class GradeTooHighException : public std::exception {
public:
virtual const char *what() const throw();
};
class GradeTooLowException : public std::exception {
public:
virtual const char *what() const throw();
};
class NotSigned : public std::exception {
public:
virtual const char *what() const throw();
};
std::string getName(void) const;
bool getSigned(void) const;
uint8_t getMinForSign(void) const;
uint8_t getMinForExec(void) const;
void beSigned(Bureaucrat);
void execute(const Bureaucrat &) const;
private:
std::string _name;
bool _signed;
const uint8_t _minForSign;
const uint8_t _minForExec;
virtual void _exec(const Bureaucrat &) const = 0;
void _gradeCheck(void) const;
};
std::ostream &operator<<(std::ostream &, AForm &);

115
ex03/Bureaucrat.cpp Normal file
View File

@ -0,0 +1,115 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Bureaucrat.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/23 13:59:45 by adjoly #+# #+# */
/* Updated: 2025/04/03 14:21:09 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "Bureaucrat.hpp"
#include "AForm.hpp"
#include <exception>
void _log(std::string emoji, std::string what, std::string who,
std::string str) {
#ifdef VERBOSE
if (who.empty())
std::cout << "" << emoji << "" << what << ": " << str << std::endl;
else
std::cout << "" << emoji << "" << what << "(" << who << "): " << str
<< std::endl;
#else
(void)emoji, (void)what, (void)who, (void)str;
#endif
}
Bureaucrat::Bureaucrat(void) {
_log("", "Bureaucrat", "", "default constructor called");
}
Bureaucrat::Bureaucrat(const Bureaucrat &cpy) {
_log("", "Bureaucrat", "", "copy constructor called");
if (&cpy != this)
*this = cpy;
}
Bureaucrat::Bureaucrat(std::string name, uint8_t grade)
: _name(name), _grade(grade) {
_log("", "Bureaucrat", "", "constructor called");
}
const std::string &Bureaucrat::getName(void) const { return _name; }
uint8_t Bureaucrat::getGrade(void) const { return _grade; }
Bureaucrat::~Bureaucrat(void) {
_log("", "Bureaucrat", "", "destructor called");
}
Bureaucrat &Bureaucrat::operator=(Bureaucrat const &cpy) {
if (&cpy == this)
return *this;
_grade = cpy._grade;
return *this;
}
void Bureaucrat::executeForm(const AForm &form) const {
form.execute(*this);
}
Bureaucrat &Bureaucrat::operator++(void) {
_grade--;
if (_grade < MAXGRADE)
throw GradeTooHighException();
return *this;
}
Bureaucrat &Bureaucrat::operator--(void) {
_grade++;
if (_grade > MINGRADE)
throw GradeTooLowException();
return *this;
}
Bureaucrat Bureaucrat::operator++(int) {
Bureaucrat old = *this;
_grade--;
if (_grade < MAXGRADE)
throw GradeTooHighException();
return (old);
}
Bureaucrat Bureaucrat::operator--(int) {
Bureaucrat old = *this;
_grade++;
if (_grade > MINGRADE)
throw GradeTooLowException();
return old;
}
std::ostream &operator<<(std::ostream &os, Bureaucrat &val) {
os << val.getName() << ", bureaucrat grade " << (int)val.getGrade();
return os;
}
const char *Bureaucrat::GradeTooHighException::what() const throw() {
return ("Grade is too high");
}
const char *Bureaucrat::GradeTooLowException::what() const throw() {
return ("Grade is too low");
}
void Bureaucrat::signForm(AForm &f) {
try {
f.beSigned(*this);
std::cout << _name << " signed " << f.getName() << std::endl;
} catch (std::exception &e) {
std::cout << _name << " counldn't sign " << f.getName() << " because " << e.what() << std::endl;
}
}

69
ex03/Bureaucrat.hpp Normal file
View File

@ -0,0 +1,69 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Bureaucrat.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/23 13:59:43 by adjoly #+# #+# */
/* Updated: 2025/04/03 13:50:01 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include <exception>
#include <fstream>
#include <iostream>
#include <stdexcept>
#include <string>
void _log(std::string emoji, std::string what, std::string who,
std::string str);
class AForm;
typedef unsigned char uint8_t;
#define MAXGRADE 1
#define MINGRADE 150
class Bureaucrat {
public:
Bureaucrat(void);
Bureaucrat(const Bureaucrat &cpy);
Bureaucrat(std::string name, uint8_t grade);
~Bureaucrat(void);
const std::string &getName(void) const;
uint8_t getGrade(void) const;
void executeForm(const AForm &) const;
class GradeTooHighException : public std::exception {
public:
virtual const char *what() const throw();
};
class GradeTooLowException : public std::exception {
public:
virtual const char *what() const throw();
};
// Copy assignement operator
Bureaucrat &operator=(Bureaucrat const &);
// Preincrement operator
Bureaucrat &operator++(void);
Bureaucrat &operator--(void);
// Post increment operator
Bureaucrat operator++(int);
Bureaucrat operator--(int);
void signForm(AForm &);
private:
const std::string _name;
uint8_t _grade;
};
std::ostream &operator<<(std::ostream &, Bureaucrat &);

63
ex03/Intern.cpp Normal file
View File

@ -0,0 +1,63 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Intern.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/03 15:24:46 by adjoly #+# #+# */
/* Updated: 2025/04/03 15:57:18 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "Intern.hpp"
#include "Bureaucrat.hpp"
#include "PresidentialPardonForm.hpp"
#include "RobotomyRequestForm.hpp"
#include "ShrubberyCreationForm.hpp"
#include <cstddef>
Intern::Intern(void) {
_log("", "Intern", "", "default constructor called");
}
Intern::Intern(const Intern &cpy) {
_log("", "Intern", "", "copy constructor called");
*this = cpy;
}
Intern::~Intern(void) {
_log("", "Intern", "", "destructor called");
}
Intern &Intern::operator=(const Intern &) {
_log("", "Intern", "", "copy assignement constructor called");
return *this;
}
AForm *newShrubbery(std::string &target) {
return new ShrubberyCreationForm(target);
}
AForm *newPresidential(std::string &target) {
return new PresidentialPardonForm(target);
}
AForm *newRobotomy(std::string &target) {
return new RobotomyRequestForm(target);
}
AForm *Intern::makeForm(std::string name, std::string target) const {
std::string formName[] = {"robotomy request", "shrubbery request", "presidential pardon request"};
AForm *(*newForm[])(std::string &) = {&newRobotomy, &newShrubbery, &newPresidential};
for (size_t i = 0; i < 3; i++) {
if (formName[i] == name) {
AForm *n = newForm[i](target);
std::cout << "Intern creates " << name << std::endl;
return n;
}
}
std::cerr << "Intern doesn't know " << name << std::endl;
return NULL;
}

30
ex03/Intern.hpp Normal file
View File

@ -0,0 +1,30 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Intern.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/03 15:04:27 by adjoly #+# #+# */
/* Updated: 2025/04/03 15:12:56 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include <string>
#include <iostream>
class AForm;
class Intern {
public:
Intern(void);
Intern(const Intern &);
~Intern(void);
AForm *makeForm(std::string, std::string) const;
Intern &operator=(const Intern &);
private:
};

60
ex03/Makefile Normal file
View File

@ -0,0 +1,60 @@
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/10/25 16:09:27 by adjoly #+# #+# #
# Updated: 2025/04/03 16:06:27 by adjoly ### ########.fr #
# #
# **************************************************************************** #
SHELL = bash
NAME = Intern
CC = c++
OBJSDIR = obj/
SRCS = $(shell find . -name '*.cpp')
OBJS = $(addprefix $(OBJSDIR), $(SRCS:.cpp=.o))
FLAGS = -Wall -Werror -Wextra -std=c++98 -MMD -MP
RED = \033[0;31m
GREEN = \033[0;32m
YELLOW = \033[1;33m
PURPLE = \e[0;35m
NC = \033[0m
DELETE = \x1B[2K\r
ifeq ($(VERBOSE),true)
FLAGS += -D VERBOSE
endif
all: $(NAME)
$(NAME): $(OBJS)
@$(CC) $(FLAGS) -I . $(OBJS) -o $(NAME)
@printf "$(YELLOW)「✨」($(NAME)) Program compiled\n"
$(OBJSDIR)%.o: %.cpp
@mkdir -p $(@D)
@$(CC) $(FLAGS) -I . -c $< -o $@
@printf "$(DELETE)$(GREEN)「🔨」($<) Object compiled\n"
clean:
@rm -f $(OBJS)
@printf "$(DELETE)$(RED)「🗑️」($(OBJS)) Object deleted\n"
fclean: clean
@rm -f $(NAME)
@rm -Rf $(OBJSDIR)
@printf "$(RED)「🗑️」($(NAME)) Program deleted\n"
re: fclean all
.PHONY: clean fclean all re

View File

@ -0,0 +1,48 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* PresidentialPardonForm.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/03 09:45:26 by adjoly #+# #+# */
/* Updated: 2025/04/03 14:13:21 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "PresidentialPardonForm.hpp"
#include "AForm.hpp"
PresidentialPardonForm::PresidentialPardonForm(void)
: AForm("PresidentialPardonForm", 25, 5) {
_log("", "PresidentialPardonForm", "", "default constructor called");
}
PresidentialPardonForm::PresidentialPardonForm(
const PresidentialPardonForm &cpy) : AForm(cpy) {
_log("", "PresidentialPardonForm", "", "copy constructor called");
if (this != &cpy)
*this = cpy;
}
PresidentialPardonForm::PresidentialPardonForm(std::string &target)
: AForm(target, 25, 5) {
_log("", "PresidentialPardonForm", "", "target constructor called");
}
PresidentialPardonForm::~PresidentialPardonForm(void) {
_log("", "PresidentialPardonForm", "", "destructor called");
}
PresidentialPardonForm &
PresidentialPardonForm::operator=(const PresidentialPardonForm &cpy) {
_log("", "PresidentialPardonForm", "",
"copy assignement constructor called");
(void)cpy;
return *this;
}
void PresidentialPardonForm::_exec(const Bureaucrat &b) const {
std::cout << b.getName() << " has been pardoned by Zaphod Beeblebrox 🙀"
<< std::endl;
}

View File

@ -0,0 +1,28 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* PresidentialPardonForm.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/03 09:44:16 by adjoly #+# #+# */
/* Updated: 2025/04/03 14:04:03 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include "Bureaucrat.hpp"
#include "AForm.hpp"
class PresidentialPardonForm : public AForm {
public:
PresidentialPardonForm(void);
PresidentialPardonForm(const PresidentialPardonForm &);
PresidentialPardonForm(std::string &);
~PresidentialPardonForm(void);
PresidentialPardonForm &operator=(const PresidentialPardonForm &);
private:
void _exec(const Bureaucrat &) const;
};

View File

@ -0,0 +1,53 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* RobotomyRequestForm.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/03 09:19:30 by adjoly #+# #+# */
/* Updated: 2025/04/03 14:17:12 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "RobotomyRequestForm.hpp"
#include "Bureaucrat.hpp"
#include <cstdlib>
RobotomyRequestForm::RobotomyRequestForm(void)
: AForm("RobotomyRequestForm", 72, 45) {
_log("", "RobotomyRequestForm", "", "default constructor called");
}
RobotomyRequestForm::RobotomyRequestForm(const RobotomyRequestForm &cpy) : AForm(cpy) {
_log("", "RobotomyRequestForm", "", "copy constructor called");
if (this != &cpy)
*this = cpy;
}
RobotomyRequestForm::RobotomyRequestForm(std::string &target)
: AForm(target, 72, 45) {
_log("", "RobotomyRequestForm", "", "target constructor called");
}
RobotomyRequestForm::~RobotomyRequestForm(void) {
_log("", "RobotomyRequestForm", "", "destructor called");
}
RobotomyRequestForm &RobotomyRequestForm::operator=(const RobotomyRequestForm &cpy) {
_log("", "RobotomyRequestForm", "", "copy assignement constructor called");
(void)cpy;
return *this;
}
void RobotomyRequestForm::_exec(const Bureaucrat &b) const {
std::cout << "Drilingg noisseeeeeeee !!!" << std::endl;
std::srand(time(0));
if (std::rand() % 2) {
std::cout << b.getName() << " has been robotomized successfully ! :D" << std::endl;
} else {
std::cout << b.getName() << " robotomization failed 😿" << std::endl;
}
}

View File

@ -0,0 +1,27 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* RobotomyRequestForm.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/02 16:13:39 by adjoly #+# #+# */
/* Updated: 2025/04/03 10:02:14 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include "AForm.hpp"
class RobotomyRequestForm : public AForm {
public:
RobotomyRequestForm(void);
RobotomyRequestForm(const RobotomyRequestForm &);
RobotomyRequestForm(std::string &);
~RobotomyRequestForm(void);
RobotomyRequestForm &operator=(const RobotomyRequestForm &);
private:
void _exec(const Bureaucrat &) const;
};

View File

@ -0,0 +1,67 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ShrubberyCreationForm.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/01 09:25:06 by adjoly #+# #+# */
/* Updated: 2025/04/03 14:33:50 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "ShrubberyCreationForm.hpp"
#include "AForm.hpp"
#include <fstream>
#include <stdexcept>
#include <string>
ShrubberyCreationForm::ShrubberyCreationForm(void)
: AForm("ShrubberyCreationForm", 145, 137) {
_log("", "ShrubberyCreationForm", "", "default constructor called");
}
ShrubberyCreationForm::ShrubberyCreationForm(const ShrubberyCreationForm &cpy) : AForm(cpy) {
_log("", "ShrubberyCreationForm", "", "copy constructor called");
if (this != &cpy)
*this = cpy;
}
ShrubberyCreationForm::ShrubberyCreationForm(std::string &target)
: AForm(target, 72, 45) {
_log("", "ShrubberyCreationForm", "", "target constructor called");
}
ShrubberyCreationForm::~ShrubberyCreationForm(void) {
_log("", "ShrubberyCreationForm", "", "destructor called");
}
ShrubberyCreationForm &ShrubberyCreationForm::operator=(const ShrubberyCreationForm &cpy) {
_log("", "ShrubberyCreationForm", "", "copy assignement constructor called");
(void)cpy;
return (*this);
}
void ShrubberyCreationForm::_exec(const Bureaucrat &b) const {
std::ofstream file;
file.open(std::string(b.getName() + "_shruberry").c_str());
if (!file.is_open())
throw std::runtime_error("Could not write to " + b.getName() +
"_shruberry");
file << " _-_\n"
" /~~ ~~\\\n"
" /~~ ~~\\\n"
"{ }\n"
" \\ _- -_ /\n"
" ~ \\ // ~\n"
"_- - | | _- _\n"
" _ - | | -_\n"
" // \\\n";
file.close();
std::cout << "ASCII tree created in : " + b.getName() + "_shruberry"
<< std::endl;
}

View File

@ -0,0 +1,30 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ShrubberyCreationForm.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/01 09:19:24 by adjoly #+# #+# */
/* Updated: 2025/04/03 13:34:46 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include "AForm.hpp"
#include <cerrno>
#include <string>
class ShrubberyCreationForm : public AForm {
public:
ShrubberyCreationForm(void);
ShrubberyCreationForm(const ShrubberyCreationForm &);
ShrubberyCreationForm(std::string &);
~ShrubberyCreationForm(void);
ShrubberyCreationForm &operator=(const ShrubberyCreationForm &);
private:
void _exec(const Bureaucrat &) const;
};

62
ex03/main.cpp Normal file
View File

@ -0,0 +1,62 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/23 14:01:11 by adjoly #+# #+# */
/* Updated: 2025/04/03 15:51:43 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "Bureaucrat.hpp"
#include "AForm.hpp"
#include "Intern.hpp"
#include "ShrubberyCreationForm.hpp"
#include <iostream>
int main(void) {
Bureaucrat knl("Kanel", 10);
knl--;
std::cout << knl << std::endl;
knl++;
std::cout << knl << std::endl;
try {
knl++;
knl++;
knl++;
knl++;
knl++;
knl++;
knl++;
knl++;
knl++;
knl++;
knl++;
knl++;
knl++;
knl++;
knl++;
knl++;
knl++;
} catch (const std::exception &e) {
std::cerr << "Error : " << e.what() << std::endl;
}
Intern intern;
AForm *s;
s = intern.makeForm("robotomy request", "Kanel");
try {
s->beSigned(knl);
knl.executeForm(*s);
} catch (std::exception &e) {
std::cerr << "Error : " << e.what() << std::endl;
}
std::cout << knl << std::endl;
}