"Unable to create Nude pointer for input parameter"

Forum for posting problems using QxOrm library

"Unable to create Nude pointer for input parameter"

Postby SteveW » Mon Apr 18, 2016 4:44 pm

Hello,

Now I have sorted out my build problems and have a project based on Qt 5.6.0 and QxORM 1.4.2, I am attempting to get to bottom of the last actual issue I had with QxORM generated code (post viewtopic.php?f=2&t=463#p1399), but I have another issue now preventing me from being able to look at that. Or maybe it is the same issue, but because the debug build ASSERT's and release doesn't, they just look like different things. I won't know until I'm passed the problem I will desribe below...

From the front end Qt Quick/QML application we have the code:

C++
Code: Select all
   QQuickView qmlView;
   QString sQmlFile = "qrc:/main.qml";
   qmlView.rootContext()->setContextProperty("customer_main_record", pModel);
   qmlView.setSource(QUrl(sQmlFile));
   qmlView.show();


And then when a button is clicked the fetch_all is issued:

QML
Code: Select all
Button {
         text: "Fetch All"
         onClicked: customer_main_record.qxFetchAll_()
      }


When the button is clicked, the server picks up the request ok, and eventually ends up in:

Code: Select all
qx_bool QxConvert_FromJson_Helper(const QJsonValue & j, qx::service::QxTransaction & t, const QString & format)
...
      qx::service::IxParameter * ptr = qx::create_nude_ptr<qx::service::IxParameter>(sClassName);
      if (! ptr) { qAssertMsg(false, "[QxOrm] qx::cvt::detail::QxConvert_FromJson< qx::service::QxTransaction >, loading QJson", "unable to create nude pointer for input parameter"); }


Which then ASSERTS with ptr=NULL because it cannot create the "nude_ptr". sClassName at this point is: "customer_main_record_input".

I have examined the m_mapFactoryX collection inside QxFactoryX::createObjectNudePtr, and it is a populated collection (count=156 items, some "empty" items, and some which correspond to our database schema). Related to the table in question, one of the collection items is "services::customer_main_record_input". (See screenshot of debug output - sorry for the poor resolution i had to resize to fit it into the forum's 256Kb limit).

I can see that this item was added to the collection via the line:

Code: Select all
QX_REGISTER_COMPLEX_CLASS_NAME_CPP_CRM_SERVICES(services::customer_main_record_input, services_customer_main_record_input)


inside the generated source code file "customer_main_record.services.gen.cpp"

The issue seems to be that sClassName = "customer_main_record_input" but the name of the key in the collection is "services::customer_main_record_input".

I am not sure what to do next?

Thanks,
Steve
Attachments
qxorm1.jpg
qxorm1.jpg (228.89 KiB) Viewed 10070 times
SteveW
 
Posts: 53
Joined: Tue Jan 19, 2016 4:12 pm

Re: "Unable to create Nude pointer for input parameter"

Postby qxorm » Mon Apr 18, 2016 7:08 pm

Hello,

The issue seems to be that sClassName = "customer_main_record_input" but the name of the key in the collection is "services::customer_main_record_input".

Yes I think you are right.

The problem seems to come from the macro : QX_SERVICE_IX_PARAMETER_SERIALIZATION_CPP (defined in file ./include/QxService/IxParameter.h of QxOrm packge) :
Code: Select all
#define QX_SERVICE_IX_PARAMETER_SERIALIZATION_CPP(className) \
QX_SERVICE_IX_PARAMETER_QDATASTREAM_CPP(className) \
QX_SERVICE_IX_PARAMETER_QJSON_CPP(className) \
void className::registerClass() const { qx::QxClass< className >::getSingleton(); } \
QString className::getClassName() const { return #className; }

The last line returns the class name passed to the macro.
In case of classes inside namespace, this macro needs the full class name, including namespace.

And it seems that QxEntityEditor puts just class name, without namespace :
Code: Select all
QX_SERVICE_IX_PARAMETER_SERIALIZATION_CPP(blog_input)
QX_SERVICE_IX_PARAMETER_SERIALIZATION_CPP(blog_output)

Instead of :
Code: Select all
QX_SERVICE_IX_PARAMETER_SERIALIZATION_CPP(services::blog_input)
QX_SERVICE_IX_PARAMETER_SERIALIZATION_CPP(services::blog_output)


In the attached screenshot, I think @@CLASS_NAME@@ should be replaced by @@FULL_CLASS_NAME@@.
Could you please try that ?
Attachments
qxee_services_export.png
qxee_services_export.png (45.88 KiB) Viewed 10065 times
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am

Re: "Unable to create Nude pointer for input parameter"

Postby SteveW » Tue Apr 19, 2016 12:42 am

I setup the QxEE settings as per screenshot(s)

I could not change the "Default" code pane in QxEE, so I had to set "Custom" mode, then copy the Default code to the Custom tab and make the edits there. And then I had had to be careful because it would generate blank .H custom code instead of the Default .H, so I had to also copy the Default .H code into the Custom tab. This was quite easy to get wrong, and end up with blank code in my Custom tabs when making the code changes - in the end I had to copy code to a temp editor to save it being deleted when switching from Default to Custom.

Well finally when I had it set up as per screenshots, I generated code.

My bad, but then I went ahead and rebuilt the entire project (2 hours building time), and then when I ran it I received the same error.

On inspection of the generated CPP code, it does not seem to have picked up my Custom code because it still reads...

Code: Select all
QX_SERVICE_IX_PARAMETER_SERIALIZATION_CPP(customer_main_record_input)
QX_SERVICE_IX_PARAMETER_SERIALIZATION_CPP(customer_main_record_output)


Did I use QxEE incorrectly?
SteveW
 
Posts: 53
Joined: Tue Jan 19, 2016 4:12 pm

Re: "Unable to create Nude pointer for input parameter"

Postby SteveW » Tue Apr 19, 2016 12:42 am

.H Screenshot
Attachments
qxee_custom_h.jpg
qxee_custom_h.jpg (159.71 KiB) Viewed 10061 times
SteveW
 
Posts: 53
Joined: Tue Jan 19, 2016 4:12 pm

Re: "Unable to create Nude pointer for input parameter"

Postby SteveW » Tue Apr 19, 2016 12:42 am

.CPP screenshot
Attachments
qxee_custom_cpp.jpg
qxee_custom_cpp.jpg (179.46 KiB) Viewed 10061 times
SteveW
 
Posts: 53
Joined: Tue Jan 19, 2016 4:12 pm

Re: "Unable to create Nude pointer for input parameter"

Postby qxorm » Tue Apr 19, 2016 7:17 am

Your C++ services export settings seems OK.
I think you selected the wrong export button : please export the services classes.
And then, before compiling, check your files in : c:\__sum-it\dorothy\dorothy\code\crm\service\source\

Note : you don't have to rebuild everything !
You just change *.cpp services files.
So just build (not rebuild) your services project.
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am

Re: "Unable to create Nude pointer for input parameter"

Postby SteveW » Tue Apr 19, 2016 11:34 am

Hi

I did not use the wrong export button. I re-export the Services code after updating the templates.

Also If I change the option from Default Custom and then update CPP file template, then it generates blank .H files unless I add code to the Custom.H file tab. You cannot have "Default .H" and "Custom.CPP". And the because all the .H files change, all the dependant projects (Model View, Client Service etc) need to be rebuilt (which takes ~2 hours with the database schema we are using).

Anyway, today I regenerated it again, only this time adding some test comments to be sure it was regenerating my code as I expected it...
Attachments
qxee_custom_cpp_3.jpg
qxee_custom_cpp_3.jpg (172.89 KiB) Viewed 10056 times
Last edited by SteveW on Tue Apr 19, 2016 11:47 am, edited 4 times in total.
SteveW
 
Posts: 53
Joined: Tue Jan 19, 2016 4:12 pm

Re: "Unable to create Nude pointer for input parameter"

Postby SteveW » Tue Apr 19, 2016 11:36 am

And the generated code looks like this: (sorry for splitting post, forum only allows 1 screen shot per post).
Attachments
qxee_generated_code.jpg
qxee_generated_code.jpg (223.61 KiB) Viewed 10056 times
SteveW
 
Posts: 53
Joined: Tue Jan 19, 2016 4:12 pm

Re: "Unable to create Nude pointer for input parameter"

Postby qxorm » Tue Apr 19, 2016 6:16 pm

Hello

And the because all the .H files change, all the dependant projects (Model View, Client Service etc) need to be rebuilt (which takes ~2 hours with the database schema we are using)

If you don't want that your headers change between 2 exports, you could remove the @@COMMENT_FILE_CREATED_BY@@ placeholder from *.h template.

I did not use the wrong export button. I re-export the Services code after updating the templates.

Yes sorry it's my fault : I gave you the wrong placeholder !
Instead of @@FULL_CLASS_NAME@@ (which refers to the entity itself and not the service), replace it by : @@FULL_CLASS_NAME_SERVICES@@

So it should be :
Code: Select all
QX_SERVICE_IX_PARAMETER_SERIALIZATION_CPP(@@FULL_CLASS_NAME_SERVICES@@_input)
QX_SERVICE_IX_PARAMETER_SERIALIZATION_CPP(@@FULL_CLASS_NAME_SERVICES@@_output)


If it works fine, I will provide you a new version where the default template is fixed.

If I change the option from Default Custom and then update CPP file template, then it generates blank .H files unless I add code to the Custom.H file tab. You cannot have "Default .H" and "Custom.CPP".

I will improve that in a future release : I think I will add a button to copy/past automatically the default h/cpp template to custom.
And a QxEntityEditor manual (like the QxOrm manual) will be available soon : it should help users to understand/customize the export process...
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am

Re: "Unable to create Nude pointer for input parameter"

Postby SteveW » Thu Apr 21, 2016 12:26 pm

Hi. Thanks yes, using that updated template now generates working code. (It also runs in Debug & Release and with both compilers),

ALso, so my previous issue

Code: Select all
"invalid input parameter to call service 'customer_main_record_services::fetchAll()'"



Is gone, so must also have been related to this too.

My only final curiosity is that I did have a working build, MSVC only, (in MinGW it crashed in boost serialization) using default code, not modified templates, when I was using the BETA QxEE/QxORM you'd supplied together with Qt 5.5.0, boost serialization. It was only when moving to Qx Serialization that I think this started happening. Anyway I'm not worried about what changed between then and now, now that we are up and running, but just highlighting the fact modified template code never used to be required.
SteveW
 
Posts: 53
Joined: Tue Jan 19, 2016 4:12 pm

Next

Return to QxOrm - Help

Who is online

Users browsing this forum: No registered users and 7 guests