Skip to content

Commit

Permalink
Added #ifndef macros where they were missing
Browse files Browse the repository at this point in the history
  • Loading branch information
werkamsus committed Sep 16, 2017
1 parent e3d41be commit 9c9fe72
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 9 deletions.
10 changes: 9 additions & 1 deletion Lilith/FileTransferData.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#pragma once

#ifndef FILETRANSFERDATA_H
#define FILETRANSFERDATA_H


#include <fstream> //for std::ifstream and std::ofstream
struct FileTransferData
{
Expand All @@ -11,4 +16,7 @@ struct FileTransferData
std::ifstream infileStream; //For reading a file that is being sent
std::ofstream outfileStream; //For writing a file that is being received
char buffer[buffersize]; //buffer used for when sending or receiving to optimize constantly reallocating buffers
};
};


#endif // !FILETRANSFERDATA_H
10 changes: 9 additions & 1 deletion Lilith/Packet.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#pragma once

#ifndef PACKET_H
#define PACKET_H


class Packet
{
public:
Expand All @@ -7,4 +12,7 @@ class Packet
Packet(const Packet & p); //Will allocate new buffer but copy buffer from packet argument
int size;
char * buffer;
};
};


#endif // !PACKET_H
10 changes: 9 additions & 1 deletion Lilith/PacketManager.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#pragma once

#ifndef PACKETMANAGER_H
#define PACKETMANAGER_H


#include "Packet.h"
#include <queue>
#include <mutex>
Expand All @@ -12,4 +17,7 @@ class PacketManager
bool HasPendingPackets();
void Append(Packet p);
Packet Retrieve();
};
};


#endif // !PACKETMANAGER_H
10 changes: 9 additions & 1 deletion Lilith/PacketType.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#pragma once

#ifndef PACKETTYPE_H
#define PACKETTYPE_H


enum class PacketType
{
Instruction,
Expand All @@ -8,4 +13,7 @@ enum class PacketType
FileTransfer_EndOfFile, //Sent for when file transfer is complete
FileTransferByteBuffer, //Sent before sending a byte buffer for file transfer
FileTransferRequestNextBuffer //Sent to request the next buffer for file
};
};


#endif // !PACKETTYPE_H
10 changes: 9 additions & 1 deletion Server/FileTransferData.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#pragma once

#ifndef FILETRANSFERDATA_H
#define FILETRANSFERDATA_H



#include <fstream> //For ifstream/ofstream
struct FileTransferData
{
Expand All @@ -11,4 +17,6 @@ struct FileTransferData
std::ifstream infileStream; //For reading a file that is being sent
std::ofstream outfileStream; //For writing a file that is being received
char buffer[buffersize]; //buffer used for when sending or receiving to optimize constantly reallocating buffers
};
};

#endif // !FILETRANSFERDATA_H
10 changes: 9 additions & 1 deletion Server/Packet.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#pragma once

#ifndef PACKET_H
#define PACKET_H


class Packet
{
public:
Expand All @@ -7,4 +12,7 @@ class Packet
Packet(const Packet & p); //Will allocate new buffer but copy buffer from packet argument
int size;
char * buffer;
};
};


#endif // !PACKET_H
8 changes: 7 additions & 1 deletion Server/PacketManager.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#pragma once

#ifndef PACKETMANAGER_H
#define PACKETMANAGER_H

#include "Packet.h"
#include <queue>
#include <mutex>
Expand All @@ -13,4 +17,6 @@ class PacketManager
bool HasPendingPackets();
void Append(Packet p);
Packet Retrieve();
};
};

#endif
7 changes: 6 additions & 1 deletion Server/PacketStructs.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#pragma once
#ifndef PACKETSTRUCTS_H
#define PACKETSTRUCTS_H

#include "PacketType.h"
#include "Packet.h"
#include <string>
Expand All @@ -14,4 +17,6 @@ namespace PS //Packet Structures Namespace
std::string message;
};

}
}

#endif
7 changes: 6 additions & 1 deletion Server/PacketType.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#pragma once
#ifndef PACKETTYPE_H
#define PACKETTYPE_H

enum class PacketType
{
Instruction,
Expand All @@ -9,4 +12,6 @@ enum class PacketType
FileTransfer_EndOfFile, //Sent for when file transfer is complete
FileTransferByteBuffer, //Sent before sending a byte buffer for file transfer
FileTransferRequestNextBuffer //Sent to request the next buffer for file
};
};

#endif

0 comments on commit 9c9fe72

Please sign in to comment.