473,624 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing anobject of aclass an an argument to the funtion

Dear friends

I have to pass the objec of a class which is a part of afunction in
thefunction call.
my code looks like this now

#include <iostream.h>
#include <waspc/common.h>
#include <waspc/runtime/Runtime.h>
#include "WFWuList.h "
using std::cout;
using std::cerr;
using std::endl;
class WFStructSearch;
ArrayOfWFWuStru ctFe WfListWuClnt(
WFWuHandle,
char* process_id,
char* process_step_id ,
char* cluster_id,
WFStructSearch *search_params,
char* incl_active_wu,
int nbr_requested
);

int main (int argc,char *argv[]) {
WASP_Runtime::c lientInitialize ();
try {
WASP_Runtime::c lientStart("con f/client-core.xml", NULL);
WFWuList a;
ArrayOfWFWuStru ctFe ret;
WFStructSearch search;
ret = a.WfListWuClnt( NULL, process_id, process_step_id , cluster_id,
::WFStructSearc h &search, incl_active_wu, nbr_requested)) ;
cout << "There are " << numElements << " elements in the table"
<< endl;
}
catch (WASP_Exception *exc) {
char *trace=GET_TRAC E (exc);
cerr << "Exception during call: " << exc->getCharMessage () <<
endl;
cerr << "Stack trace follows: " << endl << trace << endl;
delete[] trace;
delete exc;
}
WASP_Runtime::c lientTerminate( );
return 0;
}
-----------------------------------------------------------------------------------------------------------------------------------------
The required function is
ArrayOfWFWuStru ctFe WfListWuClnt(
WFWuHandle,
char* process_id,
char* process_step_id ,
char* cluster_id,
WFStructSearch *search_params,
char* incl_active_wu,
int nbr_requested
);

I have already declared a class
class WFStructSearch;
search_params is the pointer to it.
And my function call is
ret = a.WfListWuClnt( NULL, process_id, process_step_id , cluster_id,
::WFStructSearc h &search, incl_active_wu, nbr_requested)) ;

And I am passing ::WFStructSearc h &search in it, Kindly let me know if
is the right way of passing to a function call

Thanks
Amit

Jan 11 '07 #1
3 1421
On Jan 11, 5:59 am, "Amit_Basna k" <Amit.Bas...@gm ail.comwrote:
Dear friends

I have to pass the objec of a class which is a part of afunction in
thefunction call.
my code looks like this now

#include <iostream.h>
#include <waspc/common.h>
#include <waspc/runtime/Runtime.h>
#include "WFWuList.h "
using std::cout;
using std::cerr;
using std::endl;
class WFStructSearch;
ArrayOfWFWuStru ctFe WfListWuClnt(
WFWuHandle,
char* process_id,
char* process_step_id ,
char* cluster_id,
WFStructSearch *search_params,
char* incl_active_wu,
int nbr_requested
);

int main (int argc,char *argv[]) {
WASP_Runtime::c lientInitialize ();
try {
WASP_Runtime::c lientStart("con f/client-core.xml", NULL);
WFWuList a;
ArrayOfWFWuStru ctFe ret;
WFStructSearch search;
ret = a.WfListWuClnt( NULL, process_id, process_step_id , cluster_id,
::WFStructSearc h &search, incl_active_wu, nbr_requested)) ;
cout << "There are " << numElements << " elements in the table"
<< endl;
}
catch (WASP_Exception *exc) {
char *trace=GET_TRAC E (exc);
cerr << "Exception during call: " << exc->getCharMessage () <<
endl;
cerr << "Stack trace follows: " << endl << trace << endl;
delete[] trace;
delete exc;
}
WASP_Runtime::c lientTerminate( );
return 0;}-----------------------------------------------------------------------------------------------------------------------------------------
The required function is
ArrayOfWFWuStru ctFe WfListWuClnt(
WFWuHandle,
char* process_id,
char* process_step_id ,
char* cluster_id,
WFStructSearch *search_params,
char* incl_active_wu,
int nbr_requested
);

I have already declared a class
class WFStructSearch;
search_params is the pointer to it.
And my function call is
ret = a.WfListWuClnt( NULL, process_id, process_step_id , cluster_id,
::WFStructSearc h &search, incl_active_wu, nbr_requested)) ;

And I am passing ::WFStructSearc h &search in it, Kindly let me know if
is the right way of passing to a function call
The ::WFStructSearc h should not be there, just &search, just as if you
had an int called foo and wanted to pass that to a function that takes
a pointer to an int you would write &foo.

--
Erik Wikström

Jan 11 '07 #2

Erik Wikström wrote:
On Jan 11, 5:59 am, "Amit_Basna k" <Amit.Bas...@gm ail.comwrote:
Dear friends

I have to pass the objec of a class which is a part of afunction in
thefunction call.
my code looks like this now

#include <iostream.h>
#include <waspc/common.h>
#include <waspc/runtime/Runtime.h>
#include "WFWuList.h "
using std::cout;
using std::cerr;
using std::endl;
class WFStructSearch;
ArrayOfWFWuStru ctFe WfListWuClnt(
WFWuHandle,
char* process_id,
char* process_step_id ,
char* cluster_id,
WFStructSearch *search_params,
char* incl_active_wu,
int nbr_requested
);

int main (int argc,char *argv[]) {
WASP_Runtime::c lientInitialize ();
try {
WASP_Runtime::c lientStart("con f/client-core.xml", NULL);
WFWuList a;
ArrayOfWFWuStru ctFe ret;
WFStructSearch search;
ret = a.WfListWuClnt( NULL, process_id, process_step_id , cluster_id,
::WFStructSearc h &search, incl_active_wu, nbr_requested)) ;
cout << "There are " << numElements << " elements in the table"
<< endl;
}
catch (WASP_Exception *exc) {
char *trace=GET_TRAC E (exc);
cerr << "Exception during call: " << exc->getCharMessage () <<
endl;
cerr << "Stack trace follows: " << endl << trace << endl;
delete[] trace;
delete exc;
}
WASP_Runtime::c lientTerminate( );
return 0;}-----------------------------------------------------------------------------------------------------------------------------------------
The required function is
ArrayOfWFWuStru ctFe WfListWuClnt(
WFWuHandle,
char* process_id,
char* process_step_id ,
char* cluster_id,
WFStructSearch *search_params,
char* incl_active_wu,
int nbr_requested
);

I have already declared a class
class WFStructSearch;
search_params is the pointer to it.
And my function call is
ret = a.WfListWuClnt( NULL, process_id, process_step_id , cluster_id,
::WFStructSearc h &search, incl_active_wu, nbr_requested)) ;

And I am passing ::WFStructSearc h &search in it, Kindly let me know if
is the right way of passing to a function call

The ::WFStructSearc h should not be there, just &search, just as if you
had an int called foo and wanted to pass that to a function that takes
a pointer to an int you would write &foo.

--
Erik Wikström

Thanks Erik
I have corrected the error , now I am mydeclaration is
ArrayOfWFWuStru ctFe WfListWuClnt( WFWuHandle,
char* process_id,
char* process_step_id ,
char* cluster_id,
WFStructSearch *search_params,
char* incl_active_wu,
int nbr_requested );

And the call is
ret = a.WfListWuClnt( NULL,
process_id,
process_step_id ,
cluster_id,
&search,
incl_active_wu,
nbr_requested);
When I compile I am getting the error " Undeclared variable
'nbr_requested' .
Since it is included in my method declaration, how come it gives
undeclared error .
Thanks for your time
Amit

Jan 11 '07 #3
On Jan 11, 10:12 am, "Amit_Basna k" <Amit.Bas...@gm ail.comwrote:
Erik Wikström wrote:
The ::WFStructSearc h should not be there, just &search, just as if you
had an int called foo and wanted to pass that to a function that takes
a pointer to an int you would write &foo.

I have corrected the error , now I am mydeclaration is
ArrayOfWFWuStru ctFe WfListWuClnt( WFWuHandle,
char* process_id,
char* process_step_id ,
char* cluster_id,
WFStructSearch *search_params,
char* incl_active_wu,
int nbr_requested );

And the call is
ret = a.WfListWuClnt( NULL,
process_id,
process_step_id ,
cluster_id,
&search,
incl_active_wu,
nbr_requested);
When I compile I am getting the error " Undeclared variable
'nbr_requested' .
Since it is included in my method declaration, how come it gives
undeclared error .
It will be declared in the method body, but it is not declared where
you call your function.

--
Erik Wikström

Jan 11 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2083
by: Alfred E Neuman | last post by:
I've read that... AClass ac = AClass( "name", 23 ); is less efficient than... AClass ac( "name", 23 ); because the first has to create a temporary object which is then assigned to ac. However, I can't seem to prove this true. I've created a class containing the following constructors and overloaded equal operator.
6
3171
by: | last post by:
Say we have the following code defining TMyMsgHandler and TMyClass typedef void (*TOnMsgReceive) (TMyMessage Msg); class TMyMsgHandler { public: TMyMsgHandler(); virtual ~TMyMsgHandler(); TOnMsgReceive *OnMsgReceive; };
7
5469
by: Robert Lario | last post by:
For examples sake I have made up a very simple example. I have an object called foo1 which is of type foo. I want to be able to call a funtion called myfunc as follows: myfunc(ref foo1) here's the function : public void myfunc(ref object foo)
5
1936
by: Lee Xuzhang | last post by:
/* from SICP -- Exercise 4.21: ((lambda (n) ((lambda (fact) (fact fact n)) (lambda (ft k) (if (= k 1) 1 (* k (ft ft (- k 1))))))) 10) */
5
25115
by: steven_orocos | last post by:
Hi, I'm tryin to pass a funtion as an argument in another funtion. This code works ---------------------------------- typedef void (*func)(int); void test1(int a){cout<<"1";} void test2(int a){cout<<"2";}
0
1067
by: ropo | last post by:
I'm creating 2 objects on a server from a remote client then calling a function on one object passing the other as an argument to this. This results in a Load lock exception. All objects are marshalbyref. Does anyone know why this happens and what I can do about it? here is the code outline
18
2859
by: tbringley | last post by:
I am a c++ newbie, so please excuse the ignorance of this question. I am interested in a way of having a class call a general member function of another class. Specifically, I am trying to write an ordinary differential equation class that would solve a general equation in the form: dx/dt = f(x,t). The ode class shouldn't know anything about f, except how to call it.
3
1585
by: moho | last post by:
Hi I'm getting some errors, xxx is not a function. I'm sending a function as an argument to a funtion: function s(x) { .... } function t(a,b,c)
6
1416
by: Rafe | last post by:
Forgive me if I mangle any terminology here, but please correct me if I do... I have an object which acts exactly like a string as long as I stay in Python land. However, I am using the object in Softimage|XSI a 3D application on Windows. It was created while (briefly) owned by Microsoft, so knowledge of COM with excel or anything else should be applicable I should think. I should also say I am a COM novice and still learning Python...
0
8234
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8677
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8620
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8474
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7158
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2605
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.