G_CHECK(2) Demeter Software G_CHECK(2) NAME g_check - send the generic check message to an object. SYNOPSIS int Universal:: _g__c_h_e_c_k ( char* objClassName ) DESCRIPTION _g__c_h_e_c_k checks whether the receiver is a legal object of class _o_b_j_C_l_a_s_s_N_a_m_e. If _o_b_j_C_l_a_s_s_N_a_m_e is not provided, the first class in the current class dictionary is used. The receiving object must be a tree object. That is, it cannot have any cycles or shared subobjects. _g__c_h_e_c_k is a generic method implemented at class Universal and inherited by any user class. ERROR MESSAGES If the receiving object is a legal object of class _o_b_j_C_l_a_s_s_N_a_m_e, _g__c_h_e_c_k displays the message "GCHECK Success: this is a legal object of type _o_b_j_C_l_a_s_s_N_a_m_e ". Otherwise, three error messages are displayed. Diagnostic An explanation of the error. Production stack dump A listing, in reverse order, of the productions in the grammar that led to the point where the error occurred. Error condition The message "GCHECK Error: this is NOT a legal object of type _o_b_j_C_l_a_s_s_N_a_m_e " is displayed. EXAMPLE Here is an example of how to use _g__c_h_e_c_k . Compound* iCompound = new Compound(); iCompound = someCompoundInstantiatingFunction(); if( iCompound->g_check() ) exit( -1 ); Of course, in this example we could have used g_parse. But since a successful send of g_parse always returns a legal object, sending g_check becomes unnecessary. This example shows that _g__c_h_e_c_k is most useful when instantiating objects with means other than g_parse. Demeter Last change: 2 October 1991 1 G_CHECK(2) Demeter Software G_CHECK(2) SEE ALSO g_parse(2), g_equal(2), g_copy(2) REFERENCES _U_s_e_r _M_a_n_u_a_l _f_o_r _T_h_e _C++ _D_e_m_e_t_e_r Walter L. Hursch Northeastern University, 1993 _T_h_e _A_n_n_o_t_a_t_e_d _C++ _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l Margaret A. Ellis and Bjarne Stroustrup Addison-Wesley, 1990 _C++ _P_r_i_m_e_r Stanley B. Lippman Addison-Wesley, 1989 Demeter Last change: 2 October 1991 2