#include<iostream>
#include<string>
#include<vector>
#include<rapidjson/document.h>
#include<rapidjson/filereadstream.h>
#include<fstream> 

using namespace std;
//using namespace rapidjson;

 
class FSMBase
{
public:
	string StateName;
	string EventName;
	std::vector<FSMBase*> subitem;

public:

	FSMBase()
	{
		std::cout << "default constructor called" << std::endl;
	}

	void getdata()
	{
		std::cout << "FSMBase called" << std::endl;
	}

	virtual void Add(FSMBase* b1) 
	{
		subitem.push_back(b1);
		b1->getdata();
	}

	~FSMBase()
	{
		std::cout << " destructor called" << std::endl;
	}
};
 

class premitivetool:public FSMBase
{	
public:

	void Add( FSMBase* b1)
	{
		subitem.push_back(b1);
		b1->getdata();
	}
};

class Event: public FSMBase
{
	string ActionType;
	string ActionParam;
public:

	void getdata(string Name, string ActType, string ActPar)
	{
		EventName = Name;
		ActionType = ActType;
		ActionParam = ActPar;
		std::cout << " " << EventName << " " << ActionType << " " << ActionParam << std::endl;
	}
};

class state:public FSMBase
{
	string EntreyMethodName;
	//state* nextstate;
	std::vector<Event*> eventitem;
public:
	/*state(string statename,Event *e1)
	{
		
		eventitem.push_back(e1);
		e1->getdata("a","b","c");pk
	}*/

	void getdata(string Name,string Methodname)
	{
		StateName = Name;
		EntreyMethodName = Methodname;
		std::cout << "  " << StateName << "  " << EntreyMethodName<<std::endl;
	}

	void Add(FSMBase * fsmbase1)
	{
		subitem.push_back(fsmbase1);
		fsmbase1->getdata();
	}
};



int main()
{
	state *State1;
	State1 = new state;
	Event *Event1;
	Event1 = new Event;
	State1->getdata("StartToolState", "EnterStartTool");
	State1->Add(Event1);

	premitivetool* prtool1;
	prtool1 = new premitivetool;
	prtool1->Add(State1);

	state* State2;
	State2= new state;
	Event* Event2;
	Event2 = new Event;
	Event2->getdata("MotionEvent","InvokeMethod","MoveToolPoints");
	State1->Add(Event1); 
	State1->Add(Event2);
	prtool1->Add(State2);
	
	delete Event2;
	delete State2;
	delete State1;
	delete Event1;

	// Open the file 
	ifstream file("FSMImplementationJSON.json");

	// Read the entire file into a string 
	string json((istreambuf_iterator<char>(file)),
		istreambuf_iterator<char>());

	// Create a Document object  
	  // to hold the JSON data 
	Document doc;

	// Parse the JSON data 
	doc.Parse(json.c_str());
	//std::cout << doc["Name"].GetString() << std::endl;

	// Check for parse errors 
	if (doc.HasParseError()) {
		cerr << "Error parsing JSON: "
			<< doc.GetParseError() << endl;
		return 1;
	}
	//// Now you can use the Document object to access the 
	//// JSON data 
	//// Open the file for reading 
	FILE* fp;
	//errno_t err;
	fopen_s(&fp,"FSMImplementationJSON.json1", "rb");

	//// Use a FileReadStream to 
	//  // read the data from the file 
	char readBuffer[65536];
	rapidjson::FileReadStream is(fp, readBuffer,sizeof(readBuffer));

	//// Parse the JSON data  
	//  // using a Document object 
	rapidjson::Document d;
	d.ParseStream(is);
	

//	if (d.HasMember("State") && d["State"].IsArray())
	{
		const rapidjson::Value& State = d["State"];
		std::cout << "State: ";
		for (rapidjson::SizeType i = 0; i < State.Size(); i++)
		{
			/*if (d.HasMember("Name") && d["Name"].IsString())
			{
				std::string name = d["Name"].GetString();
				std::cout << "name" << name << std::endl;
			}
			if (d.HasMember("EntryMethodName") && d["EntryMethodName"].IsString())
			{
				std::string entryname = d["EntryMethodName"].GetString();
				std::cout << "entryname" << entryname << std::endl;
			}*/
			if (State[i].IsString()) {
				std::string state = State[i].GetString();
				std::cout << state << " ";
			}

I am getting below errors

Severity	Code	Description	Project	File	Line	Suppression State	Details
Error (active)	E0276	name followed by '::' must be a class or namespace name	FsmImplementation	C:\Users\1038586\Downloads\FsmImplementation11142024\FsmImplementation\FsmImplementation\FSMBase.cpp	157		
Error (active)	E1696	cannot open source file "rapidjson/document.h"	FsmImplementation	C:\Users\1038586\Downloads\FsmImplementation11142024\FsmImplementation\FsmImplementation\FSMBase.cpp	4		
Error (active)	E1696	cannot open source file "rapidjson/filereadstream.h"	FsmImplementation	C:\Users\1038586\Downloads\FsmImplementation11142024\FsmImplementation\FsmImplementation\FSMBase.cpp	5		
Error (active)	E0020	identifier "Document" is undefined	FsmImplementation	C:\Users\1038586\Downloads\FsmImplementation11142024\FsmImplementation\FsmImplementation\FSMBase.cpp	135		
Error (active)	E0065	expected a ';'	FsmImplementation	C:\Users\1038586\Downloads\FsmImplementation11142024\FsmImplementation\FsmImplementation\FSMBase.cpp	157		
Error (active)	E0276	name followed by '::' must be a class or namespace name	FsmImplementation	C:\Users\1038586\Downloads\FsmImplementation11142024\FsmImplementation\FsmImplementation\FSMBase.cpp	161		
Error (active)	E0065	expected a ';'	FsmImplementation	C:\Users\1038586\Downloads\FsmImplementation11142024\FsmImplementation\FsmImplementation\FSMBase.cpp	161		
Error (active)	E0020	identifier "d" is undefined	FsmImplementation	C:\Users\1038586\Downloads\FsmImplementation11142024\FsmImplementation\FsmImplementation\FSMBase.cpp	162		
Error (active)	E0020	identifier "is" is undefined	FsmImplementation	C:\Users\1038586\Downloads\FsmImplementation11142024\FsmImplementation\FsmImplementation\FSMBase.cpp	162		
Error (active)	E0276	name followed by '::' must be a class or namespace name	FsmImplementation	C:\Users\1038586\Downloads\FsmImplementation11142024\FsmImplementation\FsmImplementation\FSMBase.cpp	167		
Error (active)	E0276	name followed by '::' must be a class or namespace name	FsmImplementation	C:\Users\1038586\Downloads\FsmImplementation11142024\FsmImplementation\FsmImplementation\FSMBase.cpp	169		
Error (active)	E0065	expected a ';'	FsmImplementation	C:\Users\1038586\Downloads\FsmImplementation11142024\FsmImplementation\FsmImplementation\FSMBase.cpp	169		
Error (active)	E0864	i is not a template	FsmImplementation	C:\Users\1038586\Downloads\FsmImplementation11142024\FsmImplementation\FsmImplementation\FSMBase.cpp	169		
Error (active)	E0439	expected a '>'	FsmImplementation	C:\Users\1038586\Downloads\FsmImplementation11142024\FsmImplementation\FsmImplementation\FSMBase.cpp	169		
Error	C1083	Cannot open include file: 'rapidjson/document.h': No such file or directory	FsmImplementation	C:\Users\1038586\Downloads\FsmImplementation11142024\FsmImplementation\FsmImplementation\FSMBase.cpp	4		

		}
		std::cout << std::endl;
	}
	//// Close the file 
	if (fp)
		fclose(fp);
	return 0;
}