Hi,
Currently I have designed the classes for my application.But how to give the access to my application to the client side,without exposing my implementation of the classes.I hope that thru interface concept we can implement it.But I am new for doing Client and server application development.
Could anybody help me i doing the client and server side development.With simple example
Thanks in advance
PSB
3 1300
Hi,
Currently I have designed the classes for my application.But how to give the access to my application to the client side,without exposing my implementation of the classes.I hope that thru interface concept we can implement it.But I am new for doing Client and server application development.
Could anybody help me i doing the client and server side development.With simple example
Thanks in advance
PSB
Message passing is a good option. Although it's not in the language, you can implement one function to recieve messages and process as a "select". A neat trick is for the sender to supply the function to be called upon completion: - class server:
-
def receive(replyFunction, msgNumber, *args):
-
# process msgNumber
-
replyFunction(msgNumber, result1, result2)
-
class client:
-
def callbackFunc(self, msgNumber, *expectedResults):
-
# process reply
-
-
def mainLoop():
-
self.server.receive(callback, 1,arg1, arg2)
My classes always end up with 4 to 8 "Getters" and "Setters" so that I don't end up doing this:
I have a class by name Point3D in Python.
class Point3D :
def __int(self):
self.__x =0.0
self.__y =0.0
self.__z =0.0
def setPoint(x,y,z):
self.__x =x
self.__y =y
self.__z =z
def getPoint(x,y,z):
x = self.__x
y = self.__y
z = self.__z
I dont want to expose the above Point3D implementation to the user /client side.To achieve that we can use interface concept.In Python to use interface concept.
How the interface class looks like for Point3D in python?.
How to implement that Interface?
How to access the implemented interface thru Interface Object in the client side?
It will be helpful if somebody proivide a piece of sample code for creating the interface for the above access at the client place
in C++ these can be done in this way
class IPoint : public IUnknown{
virtual void setPoint(int x,int y,int z)=0;
virtual void getPoint(&x,&y,&z)=0;
}
class Point3D: public IPoint {
private :
float _x ,_y,_z;
public:
void Point3D() {
_x=_y=_z =0
}
void setPoint(int x,int y,int z){
_x =x
_y =y
_z =z
}
void getPoint(&x,&y,&z){
x = _x
y = _y
z = _z
}
}
Thanks in advance
PSB
I forgot to access the Point data in the client side
IPoint *pIPoint = NULL;
pISampleInterface = CoCreateInstance(..);
...............
pISampleInterface ->QueryInstance(IID_IPoint ,(void*&)pIPoint )
// We have the pIPoint interafce
float dX =0,dY=0,dZ=0;
pIPoint->setPoint(10,20,30);
pIPoint->getPoint(&dX ,&dY,&dZ);
printf ( "%f,%f%f",dX ,dY,dZ);
10.0 20.0 30.0
Thanks
PSB
Sign in to post your reply or Sign up for a free account.
Similar topics
by: rakefet |
last post by:
Hi.
I'm really new to this world of .Net so your help would be most
appreciated...
We have API and COM interfaces developed in c. We would also like to
supply a .net interface to our clients....
|
by: Hank |
last post by:
I am writing a windows service in C#.NET which will manage image capturing
devices, when client connects to the service, at some point the service need
to expose a device dialog to the client for...
|
by: cipher |
last post by:
I have some constant values in my web service that my client application will
require. Having to keep server side and client side definitions insync is
tedious. I am trying to do something like...
|
by: Miguel Ferreira via .NET 247 |
last post by:
Hi !
I have developed a class Library with several classes and methods. Its working fine with a windows forms test application, but now i need to create a webservice that will expose those...
|
by: _dee |
last post by:
Question about best use of interfaces:
Say there's a 'Master' class that needs to implement a few
interfaces:
class Master : I1, I2, I3
{
}
The actual code already exists in smaller...
|
by: kostadin |
last post by:
I want to expose the whole functionality of a library through a web service. In order to do that of course I've created web methods for all public methods in this library. Because only public data...
|
by: Luiz |
last post by:
I'm constructing a class to database access using the
following interface component :
IDBDataAdapter my_i_DataAdapter;
......
The project has an instance of the class
OdbcDataAdapter...
|
by: =?Utf-8?B?TWFuaQ==?= |
last post by:
Hi,
I have a webservice which uses a c# Dll,This Dll is a C# class library which
contain few class .
I am able to see the class when in the Web service but when i create a stubb
class of the...
|
by: nabil035 |
last post by:
Hi,
I have a DLL that exposes interfaces (compiled with VC++ 6.0)
I've used exported functions(not interfaces) of this DLL in a .NET project and everything is alright.
The problem is that...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |