This file contains hidden or 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
| // ISU laboratory session #9, exercise #1. | |
| #include <iostream> | |
| #include "SmartString.hpp" | |
| using namespace std; | |
| int main (int argc , char * argv []) | |
| { | |
| { | |
| SmartString ss(new string("Hello world")); | |
| cout << "String length: " << ss->length() << endl; |
This file contains hidden or 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
| // ISU laboratory session #9, exercise #1. | |
| #include "SmartString.hpp" | |
| SmartString::SmartString(std::string* str) : str_(str) {} | |
| SmartString::~SmartString() // Delete string | |
| { | |
| delete str_; | |
| cout << "Destructor: string deleted!"; |
This file contains hidden or 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
| // ISU laboratory session #9, exercise #1. | |
| #include <iostream> | |
| using namespace std; | |
| class SmartString | |
| { | |
| public: | |
| SmartString(string* str); | |
| ~SmartString(); |
This file contains hidden or 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
| // ISU laboratory session #9, exercise #2. | |
| #include <iostream> | |
| #include <string> | |
| using namespace std; | |
| class SmartString | |
| { | |
| friend ostream& operator<<(ostream& os, const SmartString& ss); |
This file contains hidden or 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
| // ISU laboratory session #9, exercise #2. | |
| #include "SmartString.hpp" | |
| SmartString::SmartString(std::string* str) : str_(str), counter_(new unsigned int(1)) | |
| { | |
| // Comment | |
| } | |
| SmartString::~SmartString() // Destructor |
This file contains hidden or 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
| // ISU laboratory session #9, exercise #2. | |
| #include <iostream> | |
| #include "SmartString.hpp" | |
| using namespace std; | |
| int main () | |
| { | |
| // Step 1: Scope #1 | |
| { | |
| // Step 2 |
This file contains hidden or 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
| // ISU laboratory session #9, exercise #4-1. | |
| #include <iostream> | |
| #include <string> | |
| #include <boost/shared_ptr.hpp> | |
| using namespace std; | |
| int main() | |
| { |
This file contains hidden or 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
| SRCS=main.cpp EntryGuard.cpp ExitGuard.cpp car.cpp | |
| OBJS=$(SRCS:.cpp=.o) | |
| #BASEPATH=.. | |
| BASEPATH=~/Documents/Lab8/Ex3 | |
| ifeq (${TARGET},host) | |
| # We need to include host specific things | |
| #include ../compiler_setup.host | |
| include ~/Documents/Lab8/Ex3/compiler_setup.host | |
| endif |
This file contains hidden or 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
| // ISU laboratory session #8, exercise #3. | |
| #include <osapi/Thread.hpp> | |
| #include <osapi/Message.hpp> | |
| #include <osapi/MsgQueue.hpp> | |
| #include "car.hpp" | |
| #include "EntryGuard.hpp" | |
| #include "ExitGuard.hpp" | |
| #include <unistd.h> | |
| #include <iostream> |
This file contains hidden or 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
| // ISU laboratory session #8, exercise #3. | |
| #ifndef ENTRYGATE_HPP | |
| #define ENTRYGATE_HPP | |
| #include <osapi/Thread.hpp> | |
| #include <osapi/Message.hpp> | |
| #include <osapi/MsgQueue.hpp> | |
| #include <osapi/Utility.hpp> | |
| #include "car.hpp" | |
| struct entryGuardOpenReq : public osapi::Message |
OlderNewer